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
Key | Value | Required |
X-API-KEY | Your unique API key | Yes |
Content-Type | application/json | Yes |
Request URL parameter
| | | |
---|
space | String | Yes | This 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
description | String | Case sensitive | ?description=search_word |
initialState | Integer | Numbers only. Acceptable values 1 or 0 | ?initialState=search_number |
icon | String | Case 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 | Boolean | Case sensitive | ?deprecated=search_word |
dependantOn | Array | Case sensitive | ?dependantOn.achievementId=search_word ?dependantOn.linkType=search_word (you can find the Enum list in the AchievementLink model) |
minimumShouldMatch | Integer | Numbers only | ?minimumShouldMatch=search_number |
scheduling | Array [Object] | Complex search applies, allows full search on a complex object of Scheduling. Case 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 | String | Case 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 Metadata. Case sensitive | ?metadata.key=search_word ?metadata.value=search_number |
created | DateTime | Works with simple dates or date and time, eg: created=2016-02-07, created=2018-08-23T14:23:09 | ?created=search_DateTime |
id | String | Case sensitive | ?id=search_word |
translations | Object | Case 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
curl
--header "X-API-KEY: <your-api-key>"
--header "Content-Type: application/json"
--request GET https://app.competitionlabs.com/api/tester/achievements
{
"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"
]
}
]
}
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
{
"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
Code | HTTP Status | Description | Example |
---|
| 404 | The Request URL is incorrect | |
1007 | 404 | - The X-API-KEY is incorrect
- Incorrect space name
|
{
"errors": [
{
"message": "No key found for value - [123345567888edgddfgdrgd]",
"code": 1007,
"status": 404
}
]
}
{
"errors": [
{
"message": "No account found for space name - [test]",
"code": 1007,
"status": 404
}
]
}
|
| 401 | The X-API-KEY is missing | |
1009 | 500 | - 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
|
{
"errors": [
{
"message": "Error occurred while trying to process the request, please try again.",
"code": 1009,
"status": 500
}
]
}
|