skip to Main Content

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.

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.

PRIMARY DOMAINS

The path

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

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

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

api//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.

?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.
  • PUT – performs an `UPDATE` operation
  • DELETE – performs a `DELETE` operation

 

REST Endpoints:

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.

curl
--header "X-API-KEY: "
--request GET https://app.competitionlabs.com/api//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.

JSON example:

{
  "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.

Headers are case sensitive

--header "X-API-KEY: "
--header "Content-Type: application/json"

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

Back To Top