The GameNudge API is constructed as an REST-API with nouns and verbs.
The verbs availabe are the same as the representational states:
The nouns used are "game", "player", "score", "leaderbord" and are described below.
The only authentication needed to communicate with our API is your API-key. This can be found in your Account under Settings.
The API-key is passed in the header of your request as seen on the right.
curl -H "apikey:my_key" https://api.gamenudge.com/v1
Result
The current version of the API.
200{"message":"API version is 1.0"}
Retrieves a list of all the games that is registered under your API-key.
No additional parameters required.
JSON-array where each item is a game as described below.
Field | Type | Value |
---|---|---|
id | String | The unique ID of your game. This value is used when retrieving a spcific game or when otherwise manipulating a specific game or its data. |
name | String | The name that you have given your game. |
num_players | Integer | The number of players currently active in your game. |
players | Array | Array of all the players in your game |
List of games.
200
[
{
"id":"JUpdHzoNPLi4ymAsYz3r4",
"name":"My first game",
"num_players":2,
"players":[
]
},
{
"id":"AhkwedLKHinkawasdewwe3",
"name":"My second game",
"num_players":3,
"players":[
]
}
]
Retrieves data on one specific game.
No additonal parameters required.
Field | Type | Value |
---|---|---|
id | String | The unique ID of your game. This value is used when retrieving a spcific game or when otherwise manipulating a specific game or its data. |
name | String | The name that you have given your game. |
num_players | Integer | The number of players currently active in your game. |
players | Array | Array of all the players in your game |
Data on the game requested.
200
{
"id":"JUpdHzoNPLi4ymAsYz3r4",
"name":"My first game",
"num_players":1,
"players":[
]
}
Create a new game.
Field | Type | Value |
---|---|---|
name | String | The name of your game. Does not need to be unique, but will be confusing if you hade multiple games with the same name. |
maxscore | Integer | The max score of your game. Please be advised that the max score of your game may be limited by your type of account. |
levels | Array | Key/value array where Key is the namn of the level and Value is the threshold to reach that level. 'Novice => 10' would create the level Novice and a player would reach that level when appointed 10 points. |
Field | Type | Value |
---|---|---|
id | String | The unique ID of your game. This value is used when retrieving a spcific game or when otherwise manipulating a specific game or its data. |
name | String | The name that you have given your game. |
num_players | Integer | The number of players currently active in your game. |
players | Array | Array of all the players in your game |
Data on the game just created.
201
{
"id":"JUpdHzoNPLi4ymAsYz3r4",
"name":"My first game",
"num_players":1,
"players":[
]
}
Delete a game. Just pass the game id in the URL
Retrieves a list of all the players registered under your API-key.
No additional parameters required.
JSON-array where each item is a game as described below.
Field | Type | Value |
---|---|---|
name | String | The name of ypur player. |
gn_id | String | The unique GameNudge ID given to the player. |
player_id | String | The unique player id that you assigned to the player when creating it. |
[
{
"name":"Player One",
"gn_id":"WPZ6MeasdwdasjNXvfwn9jgg",
"player_id":"player.one@mydomain.site"
},
{
"name":"Player Two",
"gn_id":"WPZ6MeasdwdasjNXvfwasdasa",
"player_id":"player.two@mydomain.site"
}
]
Retrieves data on a specific player.
Add the your unique player id to the URL.
JSON-array where each item is a game as described below.
Field | Type | Value |
---|---|---|
name | String | The name of ypur player. |
gn_id | String | The unique GameNudge ID given to the player. |
player_id | String | The unique player id that you assigned to the player when creating it. |
Games | Array | Array with the unique game ids of all the games the player is participating in. |
{
"name":"Player One",
"gn_id":"WPZ6MeasdwdasjNXvfwn9jgg",
"player_id":"player.one@mydomain.site",
"games":["JUpdHzoLYRNPLi4yJ8HkY"]
}
Edit a new player. Not in beta.
Create a new player.
Field | Type | Value |
---|---|---|
name | String | The name of your player. Does not need to be unique, but will be confusing if you hade multiple players with the same name. |
uid | string | A unique identifer of your player, typically an e-mail address. |
HTTP status code.
Delete a player. Just pass the player id in the URL
Add a player to a game.
Field | Type | Value |
---|---|---|
player_uid | String | The unique identifer of your player. |
game_uid | string | The unique identifer of your game. |
game_name | string | The name of the game. |
player_gn_id | string | The unique GameNudge generated string that identifies your player. |
HTTP status code.
Remove a player from a game.
Field | Type | Value |
---|---|---|
player_uid | String | The unique identifer of your player. |
game_uid | string | The unique identifer of your game. |
HTTP status code.
Add points to a player in a game.
Field | Type | Value |
---|---|---|
player_uid | String | The unique identifer of your player. |
game_uid | string | The unique identifer of your game. |
points | number | The number of points to be added. |
HTTP status code.
The current score after the new score has been added.
200Get all the game stats on a player.
Field | Type | Value |
---|---|---|
id | String in the query | The unique identifer of your player. |
HTTP status code.
Get the leaderboard of a game.
Field | Type | Value |
---|---|---|
id | String in the query | The unique identifer of your game. |
HTTP status code.
You request has been executed as planned. This is usually returned from GET, POST, and DELETE request.
You have created for example a game or player. Note that adding scores to a player in a game does not return a 201 as the players score is nor created (PUT) but updated (POST) from one value to another (zero to something the first time) and therefore returns a 200.
Your request could not be executed due to wrong or insufficient input data from your end. Correct and try again.
Well. Something is really wrong. And this one is on us.