Skip to content

REST API Documentation

jawerty edited this page Jan 20, 2013 · 15 revisions

The API has three main types of entities: games, matches and users. A game represents a set of matches with unique gameplay. For example, Quadrow is a game. A match represents an instance of a game between two or more players. A user represents a player in a match.

Base URL

https://api.aerodeck.io/

Games

Games are defined by the server and thus read-only.

/v1/games

GET

Returns the list of games supported.

Sample Request

`curl -X GET https://api.aerodeck.io/v1/games``

Sample Response
{
  "games": [
    {
      "name": "Quadrow",
      "description": "Your favorite four in a row game",
      "path": "quadrow"
    }
  ]
}

Users

User objects are read-only unless they represent currently authenticated user, which case they are writable.

/v1/users

POST

Creates a new user.

Sample Request
curl -v -H "Content-Type: application/json" -X POST -d 
'{
  "full_name": "Craig Federighi", 
  "username": "HairForceOne", 
  "email": "[email protected]",
  "password": "abc123",
  "apn": [ "702bf7acff343b63b25c0a91c62ad1ef" ],
  "gcm": [ "4f5738aecc5979dedb8b1ed8b3a3257a" ]
}' https://api.aerodeck.io/v1/users
Sample Response
Error Codes
  • 400 Bad Request - Certain required parameters were missing

GET

Returns the list of users created.

Sample Request

curl -X GET https://api.aerodeck.io/v1/users

Sample Response
{
  [
    {
      "fullName":"Jared Wright",
      "username":"jawerty",
      "email":"[email protected]",
      "created":"Sat Jan 12 2013 20:27:36 GMT-0500 (EST)",
      "updated":"Sat Feb 22 2013 10:17:38 GMT-0500 (EST)",
      "_id":"50f20d8a9aa8036d77000002",
      "__v":0,
      "gcm":["4f5738aecc5979dedb8b1ed8b3a3257a"],
      "apn":["702bf7acff343b63b25c0a91c62ad1ef"]
    },
    {
      "fullName":"Craig Federighi",
      "username":"HairForceOne",
      "email":"[email protected]",
      "created":"Sat Jan 12 2013 20:27:36 GMT-0500 (EST)",
      "updated":"Sat Jan 12 2013 20:27:36 GMT-0500 (EST)",
      "_id":"50f32209a1894ab49e000002",
      "__v":0,
      "gcm":["4f5738aecc5979dedb8b1ed8b3a3257a"],
      "apn":["702bf7acff343b63b25c0a91c62ad1ef"]
    }
  ]
}

Query Parameters

The /v1/users end point performs one query parameter.

curl -X GET /v1/users?username=fakeuser

The username query will respond with data from the username requested.

Sample Response
{
  "fullName": "john doe",
  "username": "fakeuser",
  "email": "johndoe@###.xxx",
  "apn": "702bf7acff343b63b25c0a91c62ad1ef",
  "created": "Sat Jan 12 2013 20:27:36 GMT-0500 (EST)",
  "updated": "Sat Feb 22 2013 10:17:38 GMT-0500 (EST)",
  "_id": "50f20d8a9aa8036d77000002",
  "__v": 0,
  "gcm": [
    "4f5738aecc5979dedb8b1ed8b3a3257a"
  ],
  "apns": [
    "702bf7acff343b63b25c0a91c62ad1ef"
  ]
}

### /v1/users/:userid

#### GET

Returns a single user's **fixed** data

#### Sample request

`curl -X GET http://localhos:8000/users/50f32209a1894ab49e000002`

#### Sample response

{ "fullName":"Craig Federighi", "username":"HairForceOne", "created":"Sat Jan 12 2013 20:27:36 GMT-0500 (EST)", "updated":"Sat Jan 12 2013 20:27:36 GMT-0500 (EST)" }