зеркало из https://github.com/mozilla/galaxy-api.git
270 строки
5.4 KiB
Plaintext
270 строки
5.4 KiB
Plaintext
FORMAT: 1A
|
|
HOST: https://api-galaxy.dev.mozaws.net
|
|
|
|
# Galaxy API
|
|
|
|
## Current Version
|
|
|
|
By default, all requests receive the __v1__ version of the API. We encourage you to explicitly request the version via the `Accept` header:
|
|
|
|
Accept: application/vnd.galaxy.v1+json
|
|
|
|
## Schema
|
|
|
|
All API access is over HTTPS and is accessed from the api-galaxy.dev.mozaws.net origin. All data is sent and received as JSON.
|
|
|
|
Blank fields are included as null instead of being omitted.
|
|
|
|
All timestamps are returned in ISO 8601 format:
|
|
|
|
YYYY-MM-DDTHH:MM:SSZ
|
|
|
|
|
|
# Group Game
|
|
|
|
## Game [/games/{game_slug}]
|
|
|
|
+ Parameters
|
|
+ game_slug (string, `pokemon`) ... The slug of the Game.
|
|
|
|
+ Model (application/json)
|
|
|
|
```js
|
|
{
|
|
"description": "Full Screen Pokemon is an open source HTML5 remake of the original Pokemon games. You can play the original two generations (Red/Blue through Crystal), literally billions of procedurally generated maps, or create your own using the level editor.",
|
|
"game_url": "http://www.fullscreenpokemon.com/",
|
|
"slug": "pokemon",
|
|
"name": "Pok\u00e9mon"
|
|
}
|
|
```
|
|
|
|
### Retrieve a Game [GET]
|
|
Returns a specific Game.
|
|
|
|
+ Response 200 (application/json)
|
|
|
|
[Game][]
|
|
|
|
### Delete a Game [DELETE]
|
|
Delete a Game. The current user must be the same user who created the Game (or be an admin).
|
|
|
|
+ Response 200 (application/json)
|
|
|
|
```js
|
|
{
|
|
"success": true
|
|
}
|
|
```
|
|
|
|
### Update a Game [PATCH]
|
|
Update the fields of the Game.
|
|
|
|
+ Request (application/json)
|
|
|
|
[Game][]
|
|
|
|
+ Response 200 (application/json)
|
|
|
|
```js
|
|
{
|
|
"success": true
|
|
}
|
|
```
|
|
|
|
## Game Collection [/games]
|
|
A collection of Games.
|
|
|
|
+ Model (application/json)
|
|
|
|
```js
|
|
[
|
|
{
|
|
"description": "Full Screen Pokemon is an open source HTML5 remake of the original Pokemon games. You can play the original two generations (Red/Blue through Crystal), literally billions of procedurally generated maps, or create your own using the level editor.",
|
|
"game_url": "http://www.fullscreenpokemon.com/",
|
|
"slug": "pokemon",
|
|
"name": "Pok\u00e9mon"
|
|
},
|
|
...
|
|
]
|
|
```
|
|
|
|
### Create a Game [POST]
|
|
To create a new Game object simply provide a JSON blob of the attributes of the new Game.
|
|
|
|
+ Request (application/json)
|
|
|
|
[Game][]
|
|
|
|
+ Response 200 (application/json)
|
|
|
|
```js
|
|
{
|
|
"success": true
|
|
}
|
|
```
|
|
|
|
### Retrieve all Games [GET]
|
|
Returns a list of the Games available for a particular game.
|
|
|
|
+ Response 200 (application/json)
|
|
|
|
[Game Collection][]
|
|
|
|
|
|
# Group Leaderboard
|
|
|
|
## Leaderboard [/games/{game_slug}/leaderboards/{board_slug}]
|
|
|
|
+ Parameters
|
|
+ game_slug (string, `pokemon`) ... The slug of the Game.
|
|
+ board_slug (string, `pokeballs-collected`) ... The slug of the Leaderboard.
|
|
|
|
+ Model (application/json)
|
|
|
|
```js
|
|
{
|
|
"slug": "pokeballs-collected",
|
|
"description": "This keeps track of how many pok\u00e9balls a user finds.",
|
|
"name": "Pok\u00e9balls Collected"
|
|
}
|
|
```
|
|
|
|
### Retrieve a Leaderboard [GET]
|
|
Returns a specific Leaderboard.
|
|
|
|
+ Response 200 (application/json)
|
|
|
|
[Leaderboard][]
|
|
|
|
### Delete a Leaderboard [DELETE]
|
|
Delete a Leaderboard. The current user must be the same user who created the Leaderboard (or be an admin).
|
|
|
|
+ Response 200 (application/json)
|
|
|
|
```js
|
|
{
|
|
"success": true
|
|
}
|
|
```
|
|
|
|
### Update a Leaderboard [PATCH]
|
|
Update the fields of the Leaderboard.
|
|
|
|
+ Request (application/json)
|
|
|
|
[Leaderboard][]
|
|
|
|
+ Response 200 (application/json)
|
|
|
|
```js
|
|
{
|
|
"success": true
|
|
}
|
|
```
|
|
|
|
## Leaderboard Score [/games/{game_slug}/leaderboards/{board_slug}/scores]
|
|
|
|
+ Parameters
|
|
+ game_slug (string, `pokemon`) ... The slug of the Game.
|
|
+ board_slug (string, `pokeballs-collected`) ... The slug of the Leaderboard.
|
|
|
|
### Add a Score [POST]
|
|
Updates the score for a Leaderboard board for a particular game.
|
|
|
|
+ Request (application/json)
|
|
|
|
```js
|
|
{
|
|
"user": "cvan"
|
|
"score": 50
|
|
}
|
|
```
|
|
|
|
+ Response 200 (application/json)
|
|
|
|
```js
|
|
{
|
|
"success": true
|
|
}
|
|
```
|
|
|
|
### Retrieve all Scores [GET]
|
|
|
|
+ Response 200 (application/json)
|
|
|
|
```js
|
|
[
|
|
{
|
|
"member": "rick",
|
|
"score": "101"
|
|
},
|
|
{
|
|
"member": "mark",
|
|
"score": "99"
|
|
},
|
|
{
|
|
"member": "toby",
|
|
"score": "84"
|
|
},
|
|
{
|
|
"member": "david",
|
|
"score": "72"
|
|
},
|
|
{
|
|
"member": "cvan",
|
|
"score": "50"
|
|
},
|
|
{
|
|
"member": "bill",
|
|
"score": "39"
|
|
},
|
|
{
|
|
"member": "wil",
|
|
"score": "4"
|
|
}
|
|
]
|
|
```
|
|
|
|
## Leaderboard Collection [/games/{game_slug}/leaderboards]
|
|
A collection of Leaderboards.
|
|
|
|
+ Model (application/json)
|
|
|
|
```js
|
|
[
|
|
{
|
|
"slug": "pokeballs-collected",
|
|
"description": "This keeps track of how many pok\u00e9balls a user finds.",
|
|
"name": "Pok\u00e9balls Collected"
|
|
},
|
|
...
|
|
]
|
|
```
|
|
|
|
### Create a Leaderboard [POST]
|
|
To create a new Leaderboard object simply provide a JSON blob of the attributes of the new Leaderboard.
|
|
|
|
+ Request (application/json)
|
|
|
|
```js
|
|
{
|
|
"name": "Name of Leaderboard",
|
|
"string": "Slug of Leaderboard"
|
|
}
|
|
```
|
|
|
|
+ Response 200 (application/json)
|
|
|
|
```js
|
|
{
|
|
"success": true
|
|
}
|
|
```
|
|
|
|
### Retrieve all Leaderboards [GET]
|
|
Returns a list of the Leaderboards available for a particular game.
|
|
|
|
+ Response 200 (application/json)
|
|
|
|
[Leaderboard Collection][]
|