Players

Create Player

post

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
idstringRequired

ID value. Only alphanumeric, underscore, and hyphen are allowed.

Pattern: ^[a-zA-Z0-9_-]+$
namestringOptional
Responses
200

Successful 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

get

Get all players

Authorizations
Responses
200

Successful 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 Count

get

Get player count

Authorizations
Responses
200

Successful response

application/json
get
GET /api/players/count HTTP/1.1
Host: 
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "count": 1
}

Get Player by ID

get

Get player by ID

Authorizations
Path parameters
idstringRequired

ID value. Only alphanumeric, underscore, and hyphen are allowed.

Pattern: ^[a-zA-Z0-9_-]+$
Responses
200

Successful 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

put

Update player by ID.

Authorizations
Path parameters
idstringRequired

ID value. Only alphanumeric, underscore, and hyphen are allowed.

Pattern: ^[a-zA-Z0-9_-]+$
Body
Responses
200

Successful 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

delete

Delete player by ID

Authorizations
Path parameters
idstringRequired

ID value. Only alphanumeric, underscore, and hyphen are allowed.

Pattern: ^[a-zA-Z0-9_-]+$
Responses
200

Successful 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?