REST API
Game of Whales REST API allows "server to server" interaction between Game of Whales and your application. A call of every REST API method registers the appropriate event in Game of Whales.
Currently, REST API doesn't support the following abilities:
Every request requires game argument. You can find it in Game Key field of Game settings page.
Versions
REST API supports versioning. It means that there may be several independent versions of the same API methods.
You are able to use the selected version or use the newest version every time.
In order to use a specific version, you need to define it in Accept-Version request header. For example,
Accept-Version: 1.0.0
If you want to use the newest version of REST API every time, you need to keep Accept-Version request header empty or not use it at all.
The REST API version in use is returned to api-version response header.
You can find out the newest version of REST API by using the following request:
GET https://api.gameofwhales.com:8488/
The response will look like this:
{ "name": "Game of Whales service", "latestVersion": "2.2.0" }
Methods
REST API includes the following methods:
- acquire
- adAction
- ads
- consume
- converting
- error
- experiment
- futureOffers
- login
- offers
- profile
- purchase
- pushDelivered
- pushReacted
- receipt
- token
You can find out the schema of any methods by using the following request:
GET https://api.gameofwhales.com:8488/schema/$METHOD
For example,
GET https://api.gameofwhales.com:8488/schema/login
In order to get the schema for the specific version, it's needed to define the version in Accept-Version header of the request.
Errors
If Game of Whales server can't handle the request, the error will be returned.
The error contains the status of HTTP request and the error's details:
Parameter | Description |
---|---|
code | The code of the error. |
message | The test of the error. |
problems | More detail information about the error. The parameter is actual for request validation errors only. |
Example:
{ "code": "BadRequest", "message": "Input validation failed", "problems": [ { "keyword": "required", "dataPath": "", "schemaPath": "#/required", "params": { "missingProperty": "event" }, "message": "should have required property 'event'" } ] }
Errors codes
Code | Description |
---|---|
BadRequest | The request you sent to the server was somehow incorrect. |
InvalidVersion | The version of REST API is not supported. |
ResourceNotFound | The calling method doesn't exist. |
InternalServer | Game of Whales server can't handle the request or request doesn't match the business logic of Game of Whales system. |