Black Jack API

Base URI

http://localhost:54540/{version}
version
string required

Current API version

Default:
v1
Responses
400 Bad Request

Some of your input data was wrong

Body
Object
status
string
Example:
error
error
string
Example:
<error message>
Methods: Register
200 OK

The request succeeded

Body
Object
status
string
Example:
ok
Methods: Register
Documentation
Docs

Doc

API Methods
Authentication
POST /register
Register
POST /register

Request body

Responses

400 Bad Request

Some of your input data was wrong

200 OK

The request succeeded

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"
}
Game Actions
GET /player/{playerid}/createTable/{tablename}
GET /player/{playerid}/join/{tableid}
GET /player/{playerid}/bet/{coins}
GET /player/{playerid}/hit
GET /player/{playerid}/stand
GET /player/{playerid}/double
GET /player/{playerid}/refresh
Create Table
GET /player/{playerid}/createTable/{tablename}

Path variables

playerid
integer required

The player creating the table

tablename
string required

The name of the table

Responses

200 Created

The table has been created

Body
Object
table

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
}
Join Table
GET /player/{playerid}/join/{tableid}

Path variables

playerid
integer required

The id of the player who wants to join a table

tableid
string required

The table the player wants to join

Responses

400 Table full

The table is already full

Body
Object
status
string
Example:
error
error
string
Example:
There are already 5 players at this table
200 Joined

The player has joined the table

Body
Object
status
string
Default:
ok

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"
}
Bet
GET /player/{playerid}/bet/{coins}

Path variables

playerid
integer required

The id of the player who places a bet

coins
number required

Amount of coins to bet

Responses

200 Bet
Body
Object
status
string
Default:
ok
error
string

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
}
Hit
GET /player/{playerid}/hit

Path variables

playerid
integer required

The id of the player who is hitting

Responses

200 Hit

The player hits and gets a card back

Body
Object
card

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
}
Stand
GET /player/{playerid}/stand

Path variables

playerid
integer required

The id of the player who wants to stand

Responses

200 Stand

The player finished taking cards for this round

Body
Object
status
string
Default:
ok

Examples

GET http://localhost:54540/{version}/player/1/stand HTTP/1.1 

HTTP/1.1 200 OK 

Content-Type: application/json

{
    "status": "ok"
}
Double
GET /player/{playerid}/double

Path variables

playerid
integer required

The id of the player who wants to double down

Responses

200 Double

The player doubled down and gets a card back

Body
Object
card

The card received

400 No money

The player doesn’t have enough money to double down

Body
Object
status
string
Default:
error
error
string
Example:
Player cannot double down because account balance is smaller than the bet (50 < 100)

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)"
}
Refresh
GET /player/{playerid}/refresh

Path variables

playerid
integer required

The id of the player to refresh

Responses

200 Refresh
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
}
Data Reference
PlayerDTO
Object
Username
string

The desired username

Min length: 4
Firstname
string

The user’s first name

Min length: 2
Lastname
string

The user’s last name

Min length: 2
Password
string

The user’s password

Pattern: ^.*(?=.{8,})(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[!#$%&amp;? "]).*$
Mail
string

The user’s e-mail address

Pattern: \A(?:[a-z0-9!#$%&amp;'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&amp;'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)\Z
Methods: Register
Default Envelope
Object
status
string

The status in textform

Examples:
okerror
data
Object data_container

The resource specific data

error
string nullable

Error message, if an error happened

Card
Object
Symbol
string

The symbol on the card

Enumeration:
Club
Color
string

The color of the card

Enumeration:
Black
Value
integer

The value of the card

Art
string

The art of the card

Enumeration:
Ace
Methods: Double Hit
TableDTO
Object
Id
integer

The id of the table

Name
string

The name of the table

Methods: Create Table
PlayerRefreshDTO
Object
Cards
Array of Card

List of cards the player has

CardValue
integer

Value of all the cards combined

Busted
boolean

If the player is busted

Bet
integer

The bet the player has placed

WinMoney
integer nullable

The money the player has won

Id
integer

The id of the player

Types: RefreshDTO
RefreshDTO
Object
Finished
boolean

Wether or not the round has finished

Players
Methods: Refresh