Description:

Returns a list of achievements which you have created.

This assumes that achievements have first been uploaded via a POST request or web console otherwise no data will be returned and the value of the "totalRecordsFound" variable in metadata will be 0.

GET responses can be filtered out based on the achievement parameters or generic query parameters to filter results appropriately to get a concentrated and accurate result/response as possible.

Resource URL:

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

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 query parameters along with the generic parameters.


Query parameters 

Parameter
Type
Constraint
Usage
name
String

Case sensitive. 

For lookup you would use "name.raw=search_word" because the field "name" is indexed to support more complex searches

?name.raw=search_word
description
StringCase sensitive
?description=search_word
initialState
IntegerNumbers only. Acceptable values 1 or 0
?initialState=search_number
icon
StringCase sensitive
?icon=search_word
ruleSets
Array [Object]Complex search applies, allows full search on a complex object of ruleSet
?ruleSets.priority=search_number
?ruleSets.scope=search_word
?ruleSets.action=search_word
?ruleSets.conditions.matchCondition=search_word (you can find the Enum list in the MainConditionSet model)
?ruleSets.conditions.mustEvaluateTo=search_word
?ruleSets.conditions.rules.fact=search_word
?ruleSets.conditions.rules.operator=search_word
?ruleSets.conditions.rules.constant=search_word
?ruleSets.conditions.rules.subConditions.matchCondition=search_word (you can find the Enum list in the SubConditionSet model)
?ruleSets.conditions.rules.subConditions.mustEvaluateTo=search_word
?ruleSets.conditions.rules.subConditions.subRules.fact=search_word
?ruleSets.conditions.rules.subConditions.subRules.operator=search_word
?ruleSets.conditions.rules.subConditions.subRules.constant=search_word
deprecated
BooleanCase sensitive
?deprecated=search_word
dependantOn
ArrayCase sensitive
?dependantOn.achievementId=search_word
?dependantOn.linkType=search_word (you can find the Enum list in the AchievementLink model)
minimumShouldMatch
IntegerNumbers only
?minimumShouldMatch=search_number
scheduling
Array [Object]

Complex search applies, allows full search on a complex object of SchedulingCase sensitive.

"search_DateTime" value works with simple dates or date and time, eg: 2016-02-07, 2018-08-23T14:23:09

?scheduling.scheduleType=search_word (you can find the Enum list in the Scheduling model)
?scheduling.scheduleOccurrencesLimit=search_number
?scheduling.every=search_number
?scheduling.startDate=search_DateTime
?scheduling.endDate=search_DateTime
?scheduling.onlyAggregateOnActiveDays=search_word
achievementLiveStatus
StringCase sensitive
?achievementLiveStatus=search_word (you can find the Enum list in the Achievements overview model)
category
Array [String]Case sensitive
?category=search_word
memberGroups
Array [String]Case sensitive
?memberGroups=search_word
metadata
Array [Object]Complex search applies, allows full search on a complex object of MetadataCase sensitive
?metadata.key=search_word
?metadata.value=search_number
created
DateTimeWorks with simple dates or date and time, eg: created=2016-02-07, created=2018-08-23T14:23:09
?created=search_DateTime
id
StringCase sensitive
?id=search_word
translations
ObjectCase sensitive
?translations.eng.fieldName=search_word
?translations.eng.text=search_word
(the eng as the example is the translations key. You can find the all the translations here In the Translations)

EXAMPLE

Request
curl
--header "X-API-KEY: <your-api-key>"
--header "Content-Type: application/json"
--request GET https://app.competitionlabs.com/api/tester/achievements
Response
{
    "meta": {
        "totalRecordsFound": 1,
        "skip": 0,
        "limit": 20
    },
    "data": [
        {
            "jsonClass": "Achievement",
            "name": "test",
            "accountId": "QmTaPGUBsZyUBGOR_u9A",
            "description": "test",
            "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": "vT4bYWUBeag0_3vrTqkW"
                                }
                            ]
                        }
                    ]
                }
            ],
            "deprecated": false,
            "dependantOn": [],
            "minimumShouldMatch": 0,
            "scheduling": {
                "scheduleType": "Once",
				"scheduleOccurrencesLimit": 1,
                "every": [],
                "startDate": "2018-08-22T10:06:00.000+00:00",
                "onlyAggregateOnActiveDays": false
            },
            "achievementLiveStatus": "Test",
            "category": [],
            "memberGroups": [],
            "metadata": [],
            "created": "2018-08-22T10:08:24.086+00:00",
            "id": "vj4bYWUBeag0_3vrTqkW",
            "translations": {},
            "translatableFields": [
                "name",
                "description"
            ]
        }
    ]
}
Request with Query string parameters
curl
--header "X-API-KEY: <your-api-key>"
--header "Content-Type: application/json"
--request GET https://app.competitionlabs.com/api/tester/achievements?ruleSets.conditions.matchCondition=All&_limit=1
Response for Query string request
{
    "meta": {
        "totalRecordsFound": 2,
        "skip": 0,
        "limit": 1
    },
    "data": [
        {
            "jsonClass": "Achievement",
            "name": "test",
            "accountId": "QmTaPGUBsZyUBGOR_u9A",
            "description": "test",
            "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": "vT4bYWUBeag0_3vrTqkW"
                                }
                            ]
                        }
                    ]
                }
            ],
            "deprecated": false,
            "dependantOn": [],
            "minimumShouldMatch": 0,
            "scheduling": {
                "scheduleType": "Once",
				"scheduleOccurrencesLimit": 1,
                "every": [],
                "startDate": "2018-08-22T10:06:00.000+00:00",
                "onlyAggregateOnActiveDays": false
            },
            "achievementLiveStatus": "Test",
            "category": [],
            "memberGroups": [],
            "metadata": [],
            "created": "2018-08-22T10:08:24.086+00:00",
            "id": "vj4bYWUBeag0_3vrTqkW",
            "translations": {},
            "translatableFields": [
                "name",
                "description"
            ]
        }
    ]
}

ERROR CODES

CodeHTTP StatusDescriptionExample

404The Request URL is incorrect
Error Response 404
{
    "status": 404
}
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
        }
    ]
}

401The X-API-KEY is missing
Error Response 401
{
    "status": 401
}
1009500
  • No value was input for query by initialState
  • No value was input for query by ruleSets.priority
  • No value was input for query by ruleSets.conditions.mustEvaluateTo
  • No value was input for query by deprecated
  • No value was input for query by minimumShouldMatch
  • No value was input for query by scheduling.scheduleOccurrencesLimit
  • No value was input for query by scheduling.every
  • No value was input for query by scheduling.startDate
  • No value was input for query by scheduling.endDate
  • No value was input for query by scheduling.onlyAggregateOnActiveDays
  • No value was input for query by created


Error Response 500
{
    "errors": [
        {
            "message": "Error occurred while trying to process the request, please try again.",
            "code": 1009,
            "status": 500
        }
    ]
}