Game-Score API has 2 different endpoints - one for testing (sandbox) and one for production usage. The testing one is located at http://game-score.net/apisandbox/. The databases of sandbox endpoint is sanitized on a daily basis and each client is capable to set the exact time for this operation.
The production endpoint is located at http://game-score.net/api/. All the data collected via this endpoint is stored permanently, so be careful with its usage. Development and testing should be done using sandbox mode and moved to production mode once the application is ready.
Game-Score API can be called either POST or GET. It also support XML and JSON protocols. The server-side will automatically recognize request properties and the response will be the same method and type.
Method | URL |
---|---|
POST | api/json/ |
Method | URL |
---|---|
GET | api/json/ |
The URL construction is used to format the service communication. Next to api/ is the protocol descriptor JSON /json/ or XML /xml/.At the end comes the called API method. Parameters need to be passed in respect to the used request method. For GET request parameters are passed as URL_PARAM
Method | URL |
---|---|
GET | api/json/methodName |
Initialize new session. There will be returned session ID with the response. Used to track how many games are played in one session. It should be started right after the app is started.
Method | URL |
---|---|
GET/POST | api/json/startSession/ api/xml/startSession/ |
Type | Params | Values |
---|---|---|
var | appId | string |
appId
appId must be sent with all client requests. The appId can be obtained from games section of the Back
Office and helps the server to validate the request source.
Status | Response |
---|---|
200 | {
"success": |
403 | {"error":"API key is missing."} |
401 | {"error":"Invalid API key."} |
500 | {"error":"Something went wrong. Please try again later."} |
Adds new score to the scoreboard. If highscore is set to If true, there will be returned high score list with the response.
Method | URL |
---|---|
GET/POST | api/json/addScore/ api/xml/addScore/ |
Type | Params | Values |
---|---|---|
var | appId | string |
var | sessionid | string |
var | score | number |
var | nickname | string [optional] [default “Player”] |
var | highscore | boolean [optional] [default false] |
var | limit | number [optional] [default 10] |
var | playerRank | boolean [optional] [default false] |
appID
appID is obtained from the service Back Office
sessionid
sessionid is obtained from the startSession API method /api/json/startSession
score
The score achieved by the player
nickname
Player nickname; Optional; Default value will be “Player”
highscore
Boolean to define if highscores should be returned or not; Optional; Default value will be false
limit
Limit the amount of the returned highscores; Optional; Default value will be 10
playerRank
Boolean to define if current player rank should be returned if it is not in the given limit; Optional; Default value will be false
Status | Response |
---|---|
200 | Response will be an object containing the list of highscores.
{
"success": true, |
400 | {"error":"Missing parameter."} |
401 | {"error":"Invalid API key."} |
500 | {"error":"Something went wrong. Please try again later."} |
Returns high score with paging. Page size is defined by the limit parameter and the start parameter is used for getting next page.
Method | URL |
---|---|
GET/POST | api/json/getHighScore/ api/xml/getHighScore/ |
Type | Params | Values |
---|---|---|
var | appId | string |
var | limit | number [optional] [default 10] |
var | start | number [optional] [default 0] |
appID
appID is obtained from the service Back Office
limit
Limit the amount of the returned highscores; Optional; Default value will be 10
start
Defines the first highscore to be returned; Optional; Default value will be 0
Status | Response |
---|---|
200 | Response will be an object containing the list of highscores.
{
"success": true, |
400 | {"error":"Missing parameter."} |
401 | {"error":"Invalid API key."} |
500 | {"error":"Something went wrong. Please try again later."} |
Registers a player achievement with possibility to record first and last name, an e-mail and telephone.
The user data is not mandatory so everyone decide if they should be captured. None of these data will
be used from API Creator in any way.
* this method is available in “simple game +”
Method | URL |
---|---|
GET/POST | api/json/registerWithScore / api/xml/registerWithScore / |
Type | Params | Values |
---|---|---|
var | appId | string |
var | sessionid | string |
var | score | number |
var | nickname | string [optional] [default “Player”] |
var | firstname | string [optional] |
var | lastname | string [optional] |
var | string [optional] | |
var | phone | string [optional] |
var | highscore | boolean [optional] [default false] |
var | limit | number [optional] [default 10] |
var | playerRank | boolean [optional] [default false] |
appID
appID is obtained from the service Back Office
sessionid
sessionid is obtained from the startSession API method /api/json/startSession
score
The score achieved by the player
nickname
Player nickname; Optional; Default value will be “Player”
firstname
Player firs tname; Optional; First name of the player
lastname
Player lastkname; Optional; Last name of the player
email
Player email; Optional; Email of the player
phone
Player phone; Optional; Phone of the player
highscore
Boolean to define if highscores should be returned or not; Optional; Default value will be false
limit
Limit the amount of the returned highscores; Optional; Default value will be 10
playerRank
Boolean to define if current player rank should be returned if it is not in the given limit; Optional; Default value will be false
Status | Response |
---|---|
200 | Response will be an object containing the list of highscores.
{
"success": true, |
400 | {"error":"Missing parameter."} |
401 | {"error":"Invalid API key."} |
500 | {"error":"Something went wrong. Please try again later."} |
Closes current session. Should be used on app exit.
Method | URL |
---|---|
GET/POST | api/json/endSession/ api/xml/endSession/ |
Type | Params | Values |
---|---|---|
var | appId | string |
var | sessionId | string |
appId
appId must be sent with all client requests. The appId can be obtained from games section of the Back
Office and helps the server to validate the request source.
sessionId
sessionid is obtained from the startSession API method /api/json/startSession
Status | Response |
---|---|
200 | {
"success": |
400 | {"error":"Missing parameter."} |
401 | {"error":"Invalid API key."} |
500 | {"error":"Something went wrong. Please try again later."} |
Example provided are with JSON protocol because of the better readability.
All status codes are standard HTTP status codes. The below ones are used in this API.
2XX - Success of some kind
4XX - Error occurred in client’s part
5XX - Error occurred in server’s part
Status code | Description |
---|---|
200 | OK |
201 | Created |
202 | Accepted (Request accepted, and queued for execution) |
400 | Bad request |
401 | Authentication failure |
403 | Forbidden |
404 | Resource not found |
405 | Method Not Allowed |
409 | Conflict |
412 | Precondition Failed |
413 | Request Entity Too Large |
500 | Internal Server Error |
501 | Not Implemented |
503 | Service Unavailable |