Description:
Create Achievements and Achievements with Rewards attached to it using the CompetitionLabs API.
Resource URL:
https://<apphost>.competitionlabs.com/api/<your-space-name>/achievements
Request header
Key | Value | Required |
---|---|---|
X-API-KEY | Your unique API key | Yes |
Content-Type | application/json | Yes |
Request URL parameter
Parameter | Type | Required | Description |
---|---|---|---|
space | String | Yes | This is the space name which is linked to the account |
Post body parameters
Parameter | Type | Required | Description | ||||||
---|---|---|---|---|---|---|---|---|---|
name | String | Yes | Name of the achievement | ||||||
description | String | Optional | Description of the achievement | ||||||
initialState | Integer | Yes | Informs the state of the achievement. Acceptable values are 1 or 0. Default value is 0 | ||||||
icon | String | Yes | A unique identifier for the Icon for Achievement. Achievement icon identifier retrieved from GET Achievement icons resource | ||||||
ruleSets | Array [Object] | Yes | A Rule sets model. Rule sets POST body parameters can be found in Achievement rules. | ||||||
deprecated | Boolean | Yes | A status of archived achievements. If true that means the achievement is archived. The default value is false (not archived) | ||||||
dependantOn | Array [Object] | Optional | An Achievement link model | Type | Required | Description | |||
achievementId | String | Yes | An achievement identifier indicating which achievements will be dependant on the main achievement. Achievement identifier retrieved from GET Achievements resource | ||||||
linkType | Enum | Yes | Accepted values "Must", "Should" or "Must-Not". You can read more about dependencies here | ||||||
minimumShouldMatch | Integer | Yes | A value indicating dependant on "Should" match - how many achievements will be dependant on with a linkType of should. Default value is 0 | ||||||
scheduling | Object | Yes | A model of Scheduling | Type | Required | Description | |||
scheduleType | Enum | Yes | Accepted values "Once", "Repeatedly" (the enums "Daily", "Weekly", "Monthly" - DISCONTINUED) | ||||||
scheduleOccurrencesLimit (DISCONTINUED) | Integer | Yes | A value indicating how many times it will be issued. Default value is 1 | ||||||
every (DISCONTINUED) | Array [Integer] | Yes | A value for the parameter of the scheduleType that indicates the Daily, Weekly, Monthly repetition. EXAMPLE Monthly values - January is 1, March is 3 and so on. | ||||||
startDate | DateTime | Yes | The start date and time of a schedule. The date and time is sent in UTC. DateTime type parameters have an ISO8601 timestamp | ||||||
endDate | DateTime | Optional | The end date and time of a schedule. The date and time is sent in UTC. DateTime type parameters have an ISO8601 timestamp | ||||||
achievementLiveStatus | String | Yes | A status of the Achievement. Acceptable values "Draft" or "Live" By creating the achievement with a Live status - the achievement will not be editable anymore. Only achievements that are in Draft status can be edited! | ||||||
category | Array [String] | Optional | A list of categorised labels for the Achievements | ||||||
memberGroups | Array [String] | Optional | A list of member groups participating in the Achievement. If the field is left empty then the Achievement is open to ALL. | ||||||
metadata | Array [Object] | Optional | A list of Metadata | Type | Required | Description | |||
key | String | Yes | Is a unique identifier. | ||||||
value | String | Yes | The data that is identified. | ||||||
translations | Map [LanguageCode, Seq [Object]] | Optional | The translations model. | ||||||
*rewards | Array [Object] | Optional | A model of a Reward. *Multiple rewards can be created at the same time. No rewards added to the achievement means that the achievement is created without rewards | ||||||
Parameter | Type | Required | Description | ||||||
entityType | String | Yes | The value is "achievement" | ||||||
entityId | String | Yes | An achievement Id. The string has to be left empty as it will populate automatically when the achievement will be created | ||||||
rewardRank | String | Yes | It associates with the rank of the leaderboard. The string has to be left empty as the achievement doesn’t need to have a ranking system. | ||||||
rewardName | String | Yes | The name of a reward | ||||||
value | Double | Yes | Numerical value of the reward that will be issued based on the reward type | ||||||
rewardType | String | Yes | Reward type identifier retrieved from GET RewardTypes resource | ||||||
description | String | Optional | The description of a Reward | ||||||
delay | Integer | Optional | Delay of issuing a reward in minutes. Default value is 0 | ||||||
memberAcknowledgmentRequired | Boolean | Yes | Requires member acknowledgement to claim a reward. If set to true reward will not be automatically issued. Default is false. | ||||||
metadata | Array [Object] | Optional | A list of Metadata | Type | Required | Description | |||
key | String | Yes | Is a unique identifier. | ||||||
value | String | Yes | The data that is identified. | ||||||
period | Integer | Optional | Reward available for a period of time from issuing. Value in minutes. | ||||||
pointInTime | DateTime | Optional | Reward is available until a specific point in time EXAMPLE 2019-11-05T12:41:00.000+0000 DateTime type parameters have an ISO8601 timestamp |
EXAMPLE
ERROR CODES
Code | HTTP Status | Description | Example |
---|---|---|---|
2023 | 409 | Rules cannot be empty | |
1002 | 404 |
Rewards
| |
1008 | 406 | rewardType value is empty | |
1007 | 404 | The icon id is not in the system | |
1003 | 406 |
| |
1001 | 400 |
|