Games Host

API Endpoint

Resource Group

Authentication

Authentication management resource

POST /auth/token
Requestsexample 1
Headers
Content-Type: application/json
Body
{
  "grant_type": "password",
  "scope": "*",
  "username": "john@doe.com",
  "password": "secret",
  "client_id": 5,
  "client_secret": "xxx"
}
Responses200401
Headers
Content-Type: application/json
Body
{
  "token_type": "Bearer",
  "expired_in": 31536000,
  "access_token": "xxx",
  "refresh_token": "xxx"
}
Headers
Content-Type: application/json
Body
{
  "message": "Unauthorized",
  "status_code": 401
}

Authenticates a user
POST/auth/token

Authenticates a user and returns an Access Token, that should be sent along any restricted endpoints in the Authorization header.


DELETE /auth/token
Requestsexample 1
Headers
Content-Type: application/json
Responses200401
Headers
Content-Type: application/json
Headers
Content-Type: application/json
Body
{
  "message": "Unauthorized",
  "status_code": 401
}

Revokes a user token access
DELETE/auth/token

Revokes the user token access


User

User management resource

GET /user
Requestsexample 1
Headers
Content-Type: application/json
Authorization: Bearer AccessToken
Responses200401
Headers
Content-Type: application/json
Body
{
  "user": {
    "id": 10,
    "email": "john@doe.com",
    "created_at": "2017-02-27 16:48:21"
  }
}
Headers
Content-Type: application/json
Body
{
  "message": "Unauthorized",
  "status_code": 401
}

Show user
GET/user

Get a JSON representation of the current authenticated user.


POST /user
Requestsexample 1
Headers
Content-Type: application/json
Body
{
  "username": "john@doe.com",
  "password": "secret",
  "client_id": 5,
  "client_secret": "xxxx"
}
Responses201401422
Headers
Content-Type: application/json
Location: /user
Headers
Content-Type: application/json
Body
{
  "message": "Unauthorized",
  "status_code": 401
}
Headers
Content-Type: application/json
Body
{
  "message": "Could not create new user.",
  "status_code": 422,
  "errors": {
    "username": "The username field is required."
  }
}

Create user
POST/user

Creates a new user and returns its JSON representation.


User's GameServers

User’s game servers management resource

GET /user/gameservers
Requestsexample 1
Headers
Content-Type: application/json
Authorization: Bearer AccessToken
Responses200401
Headers
Content-Type: application/json
Body
[
  {
    "id": 8,
    "user_id": 8,
    "game_id": 1,
    "host_server_id": 1,
    "installed": 2,
    "created_at": "2017-03-02 20:33:44",
    "updated_at": "2017-03-02 20:33:44",
    "game": {
      "id": 1,
      "name": "Counter Strike : Source",
      "short_name": "css",
      "minplayers": 25,
      "maxplayers": 64,
      "cents_per_slots": 20
    },
    "hostserver": {
      "id": 1,
      "name": "Cthulhu"
    }
  }
]
Headers
Content-Type: application/json
Body
{
  "message": "Unauthorized",
  "status_code": 401
}

Show the user's game servers list
GET/user/gameservers

Get a JSON representation of the list of game servers owned by the user.


GET /user/gameservers/id
Requestsexample 1
Headers
Content-Type: application/json
Authorization: Bearer AccessToken
Responses200401404
Headers
Content-Type: application/json
Body
{
  "game_server": {
    "id": 1,
    "user_id": 1,
    "game_id": 1,
    "host_server_id": 1,
    "installed": 2,
    "created_at": "2017-03-02 20:56:27",
    "updated_at": "2017-03-02 20:56:27",
    "game": {
      "id": 1,
      "name": "Counter Strike : Source",
      "short_name": "css",
      "minplayers": 16,
      "maxplayers": 54,
      "cents_per_slots": 34
    },
    "hostserver": {
      "id": 1,
      "name": "Cthulhu"
    }
  }
}
Headers
Content-Type: application/json
Body
{
  "message": "Unauthorized",
  "status_code": 401
}
Headers
Content-Type: application/json
Body
{
  "message": "Resource Not Found",
  "status_code": 404
}

Show a user's game server
GET/user/gameservers/{id}

Get a JSON representation of a user’s game server represented by id.

The user needs to own the game server to access this endpoint

URI Parameters
HideShow
id
integer (required) 

The ID of the game server.


GET /user/gameservers/id/start
Requestsexample 1
Headers
Content-Type: application/json
Authorization: Bearer AccessToken
Responses200401404
Headers
Content-Type: application/json
Headers
Content-Type: application/json
Body
{
  "message": "Unauthorized",
  "status_code": 401
}
Headers
Content-Type: application/json
Body
{
  "message": "Resource Not Found",
  "status_code": 404
}

Start a user's game server
GET/user/gameservers/{id}/start

Will start a user’s game server.

The user needs to own the game server to access this endpoint

URI Parameters
HideShow
id
integer (required) 

The ID of the game server.


GET /user/gameservers/id/stop
Requestsexample 1
Headers
Content-Type: application/json
Authorization: Bearer AccessToken
Responses200401404
Headers
Content-Type: application/json
Headers
Content-Type: application/json
Body
{
  "message": "Unauthorized",
  "status_code": 401
}
Headers
Content-Type: application/json
Body
{
  "message": "Resource Not Found",
  "status_code": 404
}

Stop a user's game server
GET/user/gameservers/{id}/stop

Will stop a user’s game server.

The user needs to own the game server to access this endpoint

URI Parameters
HideShow
id
integer (required) 

The ID of the game server.


GET /user/gameservers/id/restart
Requestsexample 1
Headers
Content-Type: application/json
Authorization: Bearer AccessToken
Responses200401404
Headers
Content-Type: application/json
Headers
Content-Type: application/json
Body
{
  "message": "Unauthorized",
  "status_code": 401
}
Headers
Content-Type: application/json
Body
{
  "message": "Resource Not Found",
  "status_code": 404
}

Restart a user's game server
GET/user/gameservers/{id}/restart

Will restart a user’s game server.

The user needs to own the game server to access this endpoint

URI Parameters
HideShow
id
integer (required) 

The ID of the game server.


HostServer

HostServer management resource - A host server is the remote server that will host game servers.

GET /hostservers
Requestsexample 1
Headers
Content-Type: application/json
Authorization: Bearer AccessToken
Responses200401
Headers
Content-Type: application/json
Body
[
  {
    "id": 10,
    "name": "Cthulhu",
    "auth_info": {
      "key": "",
      "host": "127.0.0.1:22",
      "agent": "",
      "keytext": "",
      "password": "",
      "username": "root",
      "keyphrase": ""
    }
  }
]
Headers
Content-Type: application/json
Body
{
  "message": "Unauthorized",
  "status_code": 401
}

Show the host servers list
GET/hostservers

Get a JSON representation of all host servers.

The user needs to be an administrator to access this endpoint


GET /hostservers/id
Requestsexample 1
Headers
Content-Type: application/json
Authorization: Bearer AccessToken
Responses200401404
Headers
Content-Type: application/json
Body
{
  "host_server": {
    "id": 1,
    "name": "Cthulhu",
    "auth_info": {
      "key": "",
      "host": "127.0.0.1:22",
      "agent": "",
      "keytext": "",
      "password": "",
      "username": "root",
      "keyphrase": ""
    }
  }
}
Headers
Content-Type: application/json
Body
{
  "message": "Unauthorized",
  "status_code": 401
}
Headers
Content-Type: application/json
Body
{
  "message": "Resource Not Found",
  "status_code": 404
}

Show host server
GET/hostservers/{id}

Get a JSON representation of a host server represented by id.

The user needs to be an administrator to access this endpoint

URI Parameters
HideShow
id
integer (required) 

The ID of the hostserver.


Game

Game management resource

GET /games
Responses200
Headers
Content-Type: application/json
Body
[
  {
    "id": 10,
    "name": "Counter Strike Source",
    "shortname": "css",
    "minplayers": 5,
    "maxplayers": 64,
    "cents_per_slots": 25
  }
]

Show the games list
GET/games

Get a JSON representation of all available games.


GET /games/id
Responses200404
Headers
Content-Type: application/json
Body
{
  "game": {
    "id": 10,
    "name": "Counter Strike Source",
    "shortname": "css",
    "minplayers": 5,
    "maxplayers": 64,
    "cents_per_slots": 25
  }
}
Headers
Content-Type: application/json
Body
{
  "message": "Resource Not Found",
  "status_code": 404
}

Show a game
GET/games/{id}

Get a JSON representation of a game represented by id.

URI Parameters
HideShow
id
integer (required) 

The ID of the game.


Generated by aglio on 02 Mar 2017