Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The API documentation provides you REST API's information in how to preview, create, edit, delete different type of models like Achievements, Competitions, Contests, Rewards and many more within your space in the CompetitionLabs environment using the APP API and Public API.  APP API and Public API are different. They give different results for different reasons because for example Public API is used for public facing or administrative use so sensitive data or information should not be exposed.


Available API Resources

Page Tree Search
rootPageAPI DOCUMENTATION



Page Tree
expandCollapseAlltrue
rootAPI DOCUMENTATION





HOW TO USE THE API DOCUMENTATION?


The domain


The API documentation covers 2 primary domains that are APP API and Public API.

  • APP API is primarily used for administrative actions which allows creation/editing/cancelations/deletions of resources.
  • Public API is primarily used to build client facing interfaces.

Status
colourGreen
titleEXAMPLE

Tip
titlePRIMARY DOMAINS




The path


It determines the resource you are accessing. To determine what paths are available you need to navigate through the API documentation.

Info

Any URL part that contains a word starting with a colon ( : ) or is wrapped with symbols as shown as less than ( < ) greater than ( > ) (Example: <your-space-name>) on a path means that it is a variable/parameter that needs to be replaced with values you are trying to request.


Status
colourGreen
titleEXAMPLE

Panel

Situation: you want to get a specific Achievement by an Id

What you need to do: the documentation tells you to use the following path to do so

Code Block
api/<your-space-name>/achievements/:achievementId





Query parameters


Gives you the option to modify your request with key-value pairs that helps you filter down the response as accurate as possible. They always begin with a question mark (?) symbol. Each parameter pair is then separated with an ampersand (&) symbol.

Status
colourGreen
titleEXAMPLE

Code Block
?ruleSets.conditions.matchCondition=All&_limit=1




The method


It is a type of HTTP request you send to the server. Our documentation covers these 4 types:

  • GET - performs a `READ` operation.
  • POST -  primarily used to perform a `CREATE` operation or submit a large set of data.
  • PUTperforms an `UPDATE` operation
  • DELETE - performs a `DELETE` operation

Status
colourGreen
titleEXAMPLE

Code Block
GET /api/:space/achievements
POST /api/:space/achievements
PUT /api/:space/achievements/:achievementId
DELETE /api/:space/achievements/:achievementId




Testing endpoints


Within the CompetitionLabs documentation you will find cURL request examples, you can use them to validate API end-points using the command-line.

Status
colourGreen
titleEXAMPLE

Code Block
curl
--header "X-API-KEY: <your-api-key>"
--request GET https://app.competitionlabs.com/api/<your-space-name>/achievements


JSON (JavaScript Object Notation) a common format for sending and requesting data through our REST API. In JSON, each property and value must be wrapped with double quotation marks.

Status
colourGreen
titleEXAMPLE

Code Block
{
	"jsonClass": "Achievement",
    "name": "test",
    "accountId": "QmTaPGUBsZyUBGOR_u9A",
    "description": "test",
}




The headers


Headers are used to provide information to both the client and server. It is a property-value pair that is separated by a colon. You can send the headers with cURL through the -H or --header option or part of a JavaScript Ajax request.


Note

Headers are case sensitive


Status
colourGreen
titleEXAMPLE

Code Block
--header "X-API-KEY: <your-api-key>" \
--header "Content-Type: application/json"



Code Block
languagejs
xhr.setRequestHeader("Content-Type", "application/json");