POST /api/:space/achievements/post

Description:

Retrieve an achievement or a list of achievements from CompetitionLabs database using the POST method.

Resource URL:

https://<apphost>.competitionlabs.com/api/<your-space-name>/achievements/post

Request header

KeyValueRequired
X-API-KEY
Your unique API keyYes
Content-Type
application/jsonYes

Request URL parameter

Parameter
Type
Required
Description
space
StringYesThis is the space name which is linked to the account

Additional Query String Parameters

You can use the POST body parameters along with "_skip", "_limit" and "_sortByFields" generic parameters.

Post body parameters

Parameter
Type
Required
Description
name
StringOptionalName of the achievement
description
StringOptionalDescription of the achievement
initialState
IntegerOptional

Informs the state of the achievement. Acceptable values are 1 or 0

icon
StringOptionalIcon to display for Achievement
ruleSets
Array [Object]OptionalA list of Rule sets
deprecated
BooleanOptionalTrue means that the Achievement is deleted and archived
dependantOn
Array [Object]OptionalAn Achievement link model
minimumShouldMatch
IntegerOptionalThe minimum value of the participants that will participate in the achievement
scheduling
ObjectOptionalA module of Scheduling
achievementLiveStatus
StringOptionalA status of the Achievement in live mode, eg. Draft or Live
category
Array [String]OptionalCategorisation of the Achievements. A list of String
memberGroups
Array [String]OptionalA group of members that can receive the Achievement. A list of String
metadata
Array [Object]OptionalA list of MetaData
created
DateTimeOptionalISO8601 timestamp for when an achievement was created. All records are stored in UTC time zone.
id
StringOptionalAchievement identifier retrieved from GET Achievements resource
translationsObjectOptional?translations=search_word
(more extended search of translation involves a language that your space supports example: ?translations.eng.fieldName=search_word)

EXAMPLE

Request with Query string parameters
curl
--header "X-API-KEY: <your-api-key>"
--header "Content-Type: application/json"
--request POST https://app.competitionlabs.com/api/tester/achievements/post
-d '{"_limit": 2,"name": "test"}'
Response for Query string request
{
    "meta": {
        "totalRecordsFound": 2,
        "skip": 0,
        "limit": 20
    },
    "data": [
        {
            "jsonClass": "Achievement",
            "name": "test",
            "accountId": "QmTaPGUBsZyUBGOR_u9A",
            "description": "test",
            "initialState": 0,
            "icon": "TWTbPGUBsZyUBGORFe_T",
            "ruleSets": [
                {
                    "jsonClass": "RuleSet",
                    "priority": 1,
                    "scope": "achievement",
                    "action": "member.achievement",
                    "conditions": [
                        {
                            "jsonClass": "MainConditionSet",
                            "matchCondition": "All",
                            "mustEvaluateTo": true,
                            "rules": [
                                {
                                    "jsonClass": "MainRule",
                                    "fact": "event.count",
                                    "operator": ">=",
                                    "constant": "0",
                                    "id": "2rPvzGUBOmEkXOJniWMX"
                                }
                            ]
                        }
                    ]
                }
            ],
            "deprecated": false,
            "dependantOn": [],
            "minimumShouldMatch": 0,
            "scheduling": {
                "scheduleType": "Once",
                "every": [],
                "startDate": "2018-08-22T10:06:00.000+00:00",
                "onlyAggregateOnActiveDays": false
            },
            "achievementLiveStatus": "Test",
            "category": [],
            "memberGroups": [],
            "codeBlock": "",
            "metadata": [],
            "created": "2018-08-22T10:08:24.086+00:00",
            "id": "vj4bYWUBeag0_3vrTqkW",
            "translations": {},
            "translatableFields": [
                "name",
                "description"
            ]
        },
        {
            "jsonClass": "Achievement",
            "name": "test",
            "accountId": "QmTaPGUBsZyUBGOR_u9A",
            "description": "",
            "initialState": 0,
            "icon": "bmTbPGUBsZyUBGORMe96",
            "ruleSets": [
                {
                    "jsonClass": "RuleSet",
                    "priority": 1,
                    "scope": "achievement",
                    "action": "member.achievement",
                    "conditions": [
                        {
                            "jsonClass": "MainConditionSet",
                            "matchCondition": "All",
                            "mustEvaluateTo": true,
                            "rules": [
                                {
                                    "jsonClass": "MainRule",
                                    "fact": "event.count",
                                    "operator": ">=",
                                    "constant": "0",
                                    "id": "tz7RVWUBeag0_3vrPam4"
                                }
                            ]
                        }
                    ]
                }
            ],
            "deprecated": false,
            "dependantOn": [],
            "minimumShouldMatch": 0,
            "scheduling": {
                "scheduleType": "Once",
                "every": [],
                "startDate": "2018-08-20T05:30:00.000+00:00",
                "onlyAggregateOnActiveDays": false
            },
            "achievementLiveStatus": "Test",
            "category": [],
            "memberGroups": [],
            "codeBlock": "",
            "metadata": [],
            "created": "2018-08-20T05:31:40.857+00:00",
            "id": "uD7RVWUBeag0_3vrPam5",
            "translations": {},
            "translatableFields": [
                "name",
                "description"
            ]
        }
    ]
}

ERROR CODES

CodeHTTP StatusDescriptionExample
1007404
  • The X-API-KEY is incorrect
  • Incorrect space name
Error Response 404
{
    "errors": [
        {
            "message": "No key found for value - [123345567888edgddfgdrgd]",
            "code": 1007,
            "status": 404
        }
    ]
}
Error Response 404
{
    "errors": [
        {
            "message": "No account found for space name - [test]",
            "code": 1007,
            "status": 404
        }
    ]
}

404The Request URL is incorrect
Error Response 404
{
    "status": 404
}

401The X-API-KEY is missing
Error Response 401
{
    "status": 401
}