Request
Creates a new Blackjack game for a player. The game starts immediately with cards dealt to both the player and dealer.
Body Parameters
The name of the player. Must not be blank and cannot exceed 30 characters.
Request Example
{
"playerName": "John Doe"
}
cURL Example
curl -X POST http://localhost:8080/game/new \
-H "Content-Type: application/json" \
-d '{
"playerName": "John Doe"
}'
Response
Returns details of the newly created game.
Unique identifier for the game
Unique identifier for the player
Current status of the game (typically IN_PROGRESS for a new game)
Response Example
{
"gameId": "550e8400-e29b-41d4-a716-446655440000",
"playerId": "660e8400-e29b-41d4-a716-446655440001",
"status": "IN_PROGRESS"
}
Status Codes
Game successfully created
Validation error - player name is blank or exceeds 30 characters
Example Scenarios
Success
Request:
{
"playerName": "Alice"
}
Response (201):
{
"gameId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"playerId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
"status": "IN_PROGRESS"
}
Validation Error
Request:
Response (400):
{
"message": "Player name must not be blank"
}