skip to Main Content

The API documentation provides you with REST API information on how to preview, create, edit, and delete Achievements, Competitions, Contests, Rewards, etc. within your space in the CompetitionLabs environment, using the APP API and Public API.

APP API and Public API are different and show different information. Public API is used for public information for players, while APP API is for back-end administration, so sensitive data or information is not exposed.

How to use the API documentation

The domain

The API documentation covers two primary domains, APP API and Public API.

  • APP API is used for administrative actions, e.g. creating, editing, cancelling and deleting resources.
  • Public API is used to build client-visible interfaces.

PRIMARY DOMAINS

The path

The path 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 on a path starting with a colon ( : ) or bracketed symbol, e.g. less than ( < ), greater than ( > ) or () is a variable or parameter that needs to be replaced with values you select.

Situation: You want to get a specific Achievement using its Id.

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

api//achievements/:achievementId

Query parameters

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

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

The method

This is a type of HTTP request you send to the server. Our documentation includes four 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

In the CompetitionLabs documentation, you will find cURL request examples, which you can use 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) is a common format for sending and requesting data through our REST API. In JSON, each property and value must be bracketed 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 the server. A header 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 as 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