-
Notifications
You must be signed in to change notification settings - Fork 0
API Games
Javier Herrer edited this page May 25, 2021
·
10 revisions
- URL:
{{HOST}}/api/v1/games/{userID}
- Method:
POST
- URL Params Required:
userID=[integer]
- JSON Body:
{
"name": "podemos",
"public": true
}
- Success Response:
{
"game": {
"id": 13,
"my_pair_id": 14,
"my_player_id": 19,
"name": "podemos",
"public": true,
"players_count": 1,
"creation_date": "0001-01-01T00:00:00Z",
"end_date": "0001-01-01T00:00:00Z"
}
}
- URL:
{{HOST}}/api/v1/games/
- Method:
GET
- Success Response:
{
"games": [
{
"id": 1,
"name": "partida1",
"players_count": 2,
"creation_date": "0001-01-01T00:00:00Z",
"end_date": "0001-01-01T00:00:00Z"
},
{
"id": 2,
"name": "partida2",
"players_count": 2,
"creation_date": "0001-01-01T00:00:00Z",
"end_date": "0001-01-01T00:00:00Z"
}
]
}
- URL:
{{HOST}}/api/v1/games/tournament
- Method:
GET
- Success Response:
{
"games": [
{
"id": 8,
"name": "losmenas",
"players_count": 4,
"winned": false,
"points": 0,
"creation_date": "0001-01-01T00:00:00Z",
"end_date": "0001-01-01T00:00:00Z"
},
{
"id": 14,
"name": "tournament_game",
"players_count": 0,
"winned": false,
"points": 0,
"creation_date": "0001-01-01T00:00:00Z",
"end_date": "0001-01-01T00:00:00Z"
},
{
"id": 15,
"name": "COPY_tournament_game",
"players_count": 1,
"winned": false,
"points": 0,
"creation_date": "0001-01-01T00:00:00Z",
"end_date": "0001-01-01T00:00:00Z"
}
]
}
- URL:
{{HOST}}/api/v1/games/user/{userId}
- Method:
GET
- URL Params Required:
userID=[integer]
- Success Response:
{
"games": [
{
"id": 7,
"name": "lospanas",
"winned": true,
"points": 3,
"creation_date": "0001-01-01T00:00:00Z",
"end_date": "2021-04-06T17:43:29Z"
},
{
"id": 9,
"name": "losmenas",
"points": 5,
"creation_date": "0001-01-01T00:00:00Z",
"end_date": "2021-04-06T17:58:40Z"
}
]
}
- URL:
{{HOST}}/api/v1/games/12
- Method:
GET
- Success Response:
{
"game": {
"pairs": [
{
"id": 20,
"users": [
{
"id": 9,
"username": "javierherrer",
"player_id": 22,
"games_won": 0,
"games_lost": 0,
"created_at": "0001-01-01T00:00:00Z",
"updated_at": "0001-01-01T00:00:00Z"
}
]
},
{
"id": 21,
"users": [
{
"id": 10,
"username": "javierfuster",
"player_id": 23,
"games_won": 0,
"games_lost": 0,
"created_at": "0001-01-01T00:00:00Z",
"updated_at": "0001-01-01T00:00:00Z"
}
]
}
],
"creation_date": "0001-01-01T00:00:00Z",
"end_date": "0001-01-01T00:00:00Z"
}
}