Players
Creates a player with the given ID and an optional name. The ID must be unique, and ideally corresponds with a user ID used by the app integrating with 2bttns.
Authorizations
Body
idstringRequiredPattern:
ID value. Only alphanumeric, underscore, and hyphen are allowed.
^[a-zA-Z0-9_-]+$
namestringOptional
Responses
200
Successful response
application/json
default
Error response
application/json
post
POST /api/players/create HTTP/1.1
Host:
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 27
{
"id": "text",
"name": "text"
}
{
"createdPlayer": {
"id": "text",
"name": "text",
"createdAt": "text",
"updatedAt": "text"
}
}
Get all players
Authorizations
Responses
200
Successful response
application/json
default
Error response
application/json
get
GET /api/players HTTP/1.1
Host:
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
"players": [
{
"id": "text",
"name": "text",
"createdAt": "text",
"updatedAt": "text"
}
]
}
Get player by ID
Authorizations
Path parameters
idstringRequiredPattern:
ID value. Only alphanumeric, underscore, and hyphen are allowed.
^[a-zA-Z0-9_-]+$
Responses
200
Successful response
application/json
default
Error response
application/json
get
GET /api/players/{id} HTTP/1.1
Host:
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
"player": {
"id": "text",
"name": "text",
"createdAt": "text",
"updatedAt": "text"
}
}
Update player by ID.
Authorizations
Path parameters
idstringRequiredPattern:
ID value. Only alphanumeric, underscore, and hyphen are allowed.
^[a-zA-Z0-9_-]+$
Body
Responses
200
Successful response
application/json
default
Error response
application/json
put
PUT /api/players/{id} HTTP/1.1
Host:
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 36
{
"data": {
"id": "text",
"name": "text"
}
}
{
"updatedPlayer": {
"id": "text",
"name": "text",
"createdAt": "text",
"updatedAt": "text"
}
}
Delete player by ID
Authorizations
Path parameters
idstringRequiredPattern:
ID value. Only alphanumeric, underscore, and hyphen are allowed.
^[a-zA-Z0-9_-]+$
Responses
200
Successful response
application/json
default
Error response
application/json
delete
DELETE /api/players/{id} HTTP/1.1
Host:
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
"deletedPlayer": {
"id": "text",
"name": "text",
"createdAt": "text",
"updatedAt": "text"
}
}
Was this helpful?