Fork me on GitHub

REST API Reference

You use this REST API with 3 different keys. You should have an appid, a write key and an admin key.

Important notes:

To request some keys for your game, contact bytten.games@gmail.com.

Read operations

GET /$APPID/list

List scores

Requests a list of scores.

ParameterTypeDescription
filter
multiple
strfieldName,value
order
strEither 'asc' or 'desc'
sort
strfieldName
count
intHow many results to return. Defaults to 20

The response is a JSON array of objects for each score matching the filter:

[
    {
        'id': 57, <-- id of the score record (used in admin ops)
        'submission': ['2014-05-04 16:45:26.072', 1399218326072], <-- the date this score was submitted
        'win': true,
        'board': 'justthedungeons',
        'mods': '',
        'cheats': '',

        The following fields were defined via admin operations in this example:
        'completion': ['2014-05-04 16:45:26.072', 1399218326072],
        'duration': ['01:32:53.123', 5573123],
        'seed': '-9253512911549523',
        'coins': 576,
        'artifacts': 8,
        'playerName': 'Tom',
        'playerId': '2345678923282359',
        'image': 'http://i.imgur.com/doesntexist'
    }
]

Live example: http://lead.bytten.net/v1/lenna-dev1/list?filter=board,justthedungeons&filter=win,true&sort=duration&order=desc&count=10&filter=mods,

Write operations

POST /$APPID/add

Submit score

Submits/adds a score to a leaderboard.

ParameterTypeDescription
writeKey
mandatory
strYour private write key
win
mandatory
boolWhether the player won or not
board
mandatory
strThe ID of the board to add to
mods
strWhat mods are installed on the game. (This scheme allows scores from modded games to be filtered out, but relies on mod writers obeying the rules.)
cheats
strWhat cheats were active while playing. (If your game has cheats, it can be useful to submit this value with the score so that it can be filtered out.)
(fieldName)
multiple
(fieldType)Submit values for your custom fields

Admin operations

POST /$APPID/add-field

Create a new field

Creates a new field that can store information in score records and be used to filter and sort results.

ParameterTypeDescription
adminKey
mandatory
strYour super-secret admin key
name
mandatory
strThe name of your new field
type
mandatory
strThe type of your field. See below for supported types

Supported types:

POST /$APPID/del-field

Delete a field

Hides a field and its values from list results. The field and all the values originally present before deletion can be restored by using add-field with the same name and type.

ParameterTypeDescription
adminKey
mandatory
strYour super-secret admin key
name
mandatory
strThe name of the field to delete

POST /$APPID/del-score

Delete a score

Hides a score from list results. The score and all its values can be restored by using restore-score if you still have the score id.

ParameterTypeDescription
adminKey
mandatory
strYour super-secret admin key
id
mandatory
strThe id of the score to delete

POST /$APPID/restore-score

Restore a deleted a score

Brings back a score that was deleted with del-score.

ParameterTypeDescription
adminKey
mandatory
strYour super-secret admin key
id
mandatory
strThe id of the deleted score to restore

GET /$APPID/dump

Dump all scores

Dumps all deleted and undeleted scores in the database for your app in JSON format, along with all deleted and undeleted fields. You can use this to perform a backup. The load on the server is higher than for other queries, so please use it sparingly.

ParameterTypeDescription
adminKey
mandatory
strYour super-secret admin key