Black Jack API
Base URI
{version}
Current API version
Some of your input data was wrong
Body
Request body
Examples
POST http://localhost:54540/{version}/register HTTP/1.1
Content-Type: application/json
{
"Username": "joel",
"Firstname": "Joel",
"Lastname": "Messerli",
"Password": "PaS$w0Rt&",
"Mail": "joel@messer.li"
}
HTTP/1.1 200 OK
Content-Type: application/json
{
"status": "ok"
}
POST http://localhost:54540/{version}/register HTTP/1.1
Content-Type: application/json
{
"Username": "joel",
"Firstname": "Joel",
"Lastname": "Messerli",
"Password": "passwort",
"Mail": "joel@messer.li"
}
HTTP/1.1 400 Bad Request
Content-Type: application/json
{
"status": "error",
"error": "Password must be at least 8 characters long, contain at least 1 lowercase character, 1 uppercase character, 1 digit and one special character"
}
{playerid}
/createTable/{tablename}
{playerid}
/join/{tableid}
{playerid}
/bet/{coins}
{playerid}
/hit{playerid}
/stand{playerid}
/double{playerid}
/refresh{playerid}
/createTable/{tablename}
Path variables
The player creating the table
The name of the table
Responses
The table has been created
Body
The created table
Examples
GET http://localhost:54540/{version}/player/1/createTable/Tisch 1 HTTP/1.1
HTTP/1.1 200 OK
Content-Type: application/json
{
"status": "ok",
"data": {
"table": {
"Id": 1,
"Name": "Tisch 1"
}
},
"error": null
}
{playerid}
/join/{tableid}
Path variables
The id of the player who wants to join a table
The table the player wants to join
Responses
The table is already full
Body
The player has joined the table
Body
Examples
GET http://localhost:54540/{version}/player/1/join/1 HTTP/1.1
HTTP/1.1 200 OK
Content-Type: application/json
{
"status": "ok"
}
GET http://localhost:54540/{version}/player/1/join/1 HTTP/1.1
HTTP/1.1 400 Bad Request
Content-Type: application/json
{
"status": "error",
"error": "There are already 5 players at this table"
}
{playerid}
/bet/{coins}
Path variables
The id of the player who places a bet
Amount of coins to bet
Responses
Body
Examples
GET http://localhost:54540/{version}/player/1/bet/1 HTTP/1.1
HTTP/1.1 200 OK
Content-Type: application/json
{
"status": "ok",
"error": null
}
{playerid}
/hitPath variables
The id of the player who is hitting
Responses
The player hits and gets a card back
Body
Examples
GET http://localhost:54540/{version}/player/1/hit HTTP/1.1
HTTP/1.1 200 OK
Content-Type: application/json
{
"status": "ok",
"data": {
"card": {
"Symbol": "Spade",
"Color": "Black",
"Value": 5,
"Art": "Number"
}
},
"error": null
}
{playerid}
/standPath variables
The id of the player who wants to stand
Responses
The player finished taking cards for this round
Body
Examples
GET http://localhost:54540/{version}/player/1/stand HTTP/1.1
HTTP/1.1 200 OK
Content-Type: application/json
{
"status": "ok"
}
{playerid}
/doublePath variables
The id of the player who wants to double down
Responses
The player doubled down and gets a card back
Body
The card received
The player doesn’t have enough money to double down
Body
Examples
GET http://localhost:54540/{version}/player/1/double HTTP/1.1
HTTP/1.1 200 OK
Content-Type: application/json
{
"status": "ok",
"data": {
"card": {
"Symbol": "Spade",
"Color": "Black",
"Value": 1,
"Art": "Number"
}
},
"error": null
}
GET http://localhost:54540/{version}/player/1/double HTTP/1.1
HTTP/1.1 400 Bad Request
Content-Type: application/json
{
"status": "error",
"error": "Player cannot double down because account balance is smaller than the bet (50 < 100)"
}
{playerid}
/refreshPath variables
The id of the player to refresh
Responses
Body
Examples
GET http://localhost:54540/{version}/player/1/refresh HTTP/1.1
HTTP/1.1 200 OK
Content-Type: application/json
{
"status": "ok",
"data": {
"Finished": true,
"Players": [
{
"Cards": [
{
"Symbol": "Heart",
"Color": "Red",
"Value": 5,
"Art": "Number"
}
],
"CardValue": 5,
"Busted": false,
"Bet": 500,
"WinMoney": null,
"Id": 1
}
]
},
"error": null
}
The desired username
The user’s first name
The user’s last name
The user’s password
The user’s e-mail address
The status in textform
The resource specific data
Error message, if an error happened
The symbol on the card
The color of the card
The value of the card
The art of the card
The id of the table
The name of the table
List of cards the player has
Value of all the cards combined
If the player is busted
The bet the player has placed
The money the player has won
The id of the player
Wether or not the round has finished