This is a simple API where you can play blackjack
You can overview functions with following host https://blackjack-ix.herokuapp.com/
API to create a new game
POST /v1/games
Following params are required and should be passed in as JSON format.
param | required | type | description | sample value | |
---|---|---|---|---|---|
games | required | {} | Should contain player_count and deck_count | ||
player_count | required | Integer | Specify number of players | 3 | |
deck_count | required | Integer | Specify number of deck to be used in game | 2 |
{
"games": {
"player_count": 3,
"deck_count": 2
}
}
Response is given in JSON format and has parameters as follows
param | type | description | sample value |
---|---|---|---|
id | Integer | id of the new game | 1 |
status | String | Status of the game. "active" or "inactive" | active |
players | [] | Include status of each players | |
dealer | {} | Status of dealer |
and each player/dealer has following paramters
param | type | description | sample value |
---|---|---|---|
name | String | Name of player | Player11 |
status | String | Status of the player. Available statuses are: "playing", "win", "lose", "push" and "confirmed". | playing |
score | Integer or String | Score of player's hand. If score is hidden, "-" will be given |
20 |
hand | [String] | Cards in hand | ["8-club","3-club"] |
API to deal the game
POST /v1/games/:id/deal
Following params are required and should be passed in as JSON format.
param | required | type | description | sample value | |
---|---|---|---|---|---|
game | required | {} | Should contain player_count and deck_count | ||
player_id | required | Integer | Specify player id | 3 | |
command | required | String | Specify command you want to take. Only available "hit" or "stand" for now | hit |
{
"game": {
"player_id": 1,
"command": "hit"
}
}
Response is given in JSON format and has parameters as follows
param | type | description | sample value |
---|---|---|---|
id | Integer | id of the new game | 1 |
status | String | Status of the game. "active" or "inactive" | active |
player | {} | Status of specified player | |
dealer | {} | Status of dealer |
API to show detail of given game_id
GET /v1/games/:id
Following params are required.
param | required | type | description | sample value |
---|---|---|---|---|
id | required | Integer | game id | 1 |
Response is given in JSON format and has parameters as follows
param | type | description | sample value |
---|---|---|---|
id | Integer | id of the new game | 1 |
status | String | Status of the game. "active" or "inactive" | active |
players | [] | Include status of each players | |
dealer | {} | Status of dealer |
API to show winners of given game_id
GET /v1/games/:id/winner
Following params are required.
param | required | type | description | sample value |
---|---|---|---|---|
id | required | Integer | game id | 1 |
Response is given in JSON format and has parameters as follows
param | type | description | sample value |
---|---|---|---|
id | Integer | id of the new game | 1 |
status | String | Status of the game. "active" or "inactive" | active |
winner | [] | Names of winners |
API to deactivate game for the given game_id
PUT /v1/games/:id/finish
Following params are required.
param | required | type | description | sample value |
---|---|---|---|---|
id | required | Integer | game id | 1 |
Response is given in JSON format and has parameters as follows
param | type | description | sample value |
---|---|---|---|
id | Integer | id of the new game | 1 |
status | String | Status of the game. "active" or "inactive" | active |
players | [] | Include status of each players | |
dealer | {} | Status of dealer |