2bttns
  • Getting Started
    • What is 2bttns?
    • Quick Start
    • 🆕You Asked We Listened
  • HOW TO
    • Set up your Console
    • Use the API
    • Build a game
    • Manage game data
    • Integrate game via API
    • Retrieve scores via API
  • References
    • APIs
      • Authentication
      • Generate Game URL
      • Games
      • Game Objects
      • Tags
      • Players
      • Admin
      • Export/Import
    • Command Line Interface (CLI)
      • Install
      • Usage
      • Configuration
  • TUTORIALS
    • ✨Personalize profiles with 2bttns and Next.js
Powered by GitBook
On this page

Was this helpful?

  1. References
  2. APIs

Game Objects

PreviousGamesNextTags

Was this helpful?

Get Ranked Results

get

Get ranked Game Object results for a player

Authorizations
Query parameters
playerIdstringRequired

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

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

Specify comma-separated input tags that will be used to score the game objects associated with the output tag.

If the output tag is included in the input tags, the player's score for those game object will be used as base scores

outputTagstringRequired

Specify the output tag of the game objects to get ranked results for

Responses
200
Successful response
application/json
default
Error response
application/json
get
GET /api/game-objects/ranked?playerId=text&inputTags=text&outputTag=text HTTP/1.1
Host: 
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "scores": [
    {
      "gameObject": {
        "id": "text",
        "name": "text"
      },
      "score": 1
    }
  ]
}

Get All Game Objects

get

Get all Game Objects. Paginated by default. Supports filtering and sorting.

Authorizations
Query parameters
takeany ofOptionalDefault: 10
notOptional
or
numberOptional
skipany ofOptionalDefault: 0
notOptional
or
numberOptional
idFilterany ofOptional

Comma-separated Game Object IDs to filter by

notOptional
or
string[]Optional
allowFuzzyIdFilterbooleanOptional

Set to true to enable fuzzy ID filtering. If false, only returns exact matches.

Default: false
nameFilterany ofOptional

Comma-separated Game Object names to filter by

notOptional
or
string[]Optional
allowFuzzyNameFilterbooleanOptional

Set to true to enable fuzzy name filtering. If false, only returns exact matches.

Default: false
tagFilterany ofOptional

Comma-separated list of tag IDs the resulting game objects must have

notOptional
or
string[]Optional
tagExcludeFilterany ofOptional

Comma-separated list of tag IDs to exclude from the response. Use this to exclude game objects that have a specific tag, even if they match the requiredTags filter.

notOptional
or
string[]Optional
untaggedFilterstring · enumOptional

include: Include all game objects, regardless of whether they have tags or not.

exclude: Exclude game objects that have no tags.

untagged-only: Only return game objects that have no tags. Setting this option will ignore requiredTags and excludeTags, since tagged items shouldn't appear in the results.

Default: includePossible values:
sortFieldstring · enumOptional

Field to sort by

Possible values:
sortOrderstring · enumOptional

Sort order for the selected field

Possible values:
includeTagDatabooleanOptional

Set to true to include additional tags info in the response

Default: false
excludeGameObjectsany ofOptional

Comma-separated list of Game Object IDs to exclude from the response

notOptional
or
string[]Optional
Responses
200
Successful response
application/json
default
Error response
application/json
get
GET /api/game-objects HTTP/1.1
Host: 
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "gameObjects": [
    {
      "id": "text",
      "name": "text",
      "description": "text",
      "createdAt": "text",
      "updatedAt": "text",
      "tags": [
        "text"
      ],
      "related": [
        "text"
      ]
    }
  ],
  "tags": [
    {
      "id": "text",
      "name": "text",
      "description": "text",
      "createdAt": "text",
      "updatedAt": "text"
    }
  ]
}

Delete Game Objects

delete

Delete one or more game objects by their IDs

Authorizations
Query parameters
idstring[]Optional
Responses
200
Successful response
application/json
default
Error response
application/json
delete
DELETE /api/game-objects HTTP/1.1
Host: 
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "deletedCount": 1
}

Get Game Object Count

get

Get the total Game Object count. Supports filtering.

Authorizations
Query parameters
idFilterany ofOptional

Comma-separated Game Object IDs to filter by

notOptional
or
string[]Optional
allowFuzzyIdFilterbooleanOptional

Set to true to enable fuzzy ID filtering. If false, only returns exact matches.

Default: false
nameFilterany ofOptional

Comma-separated Game Object names to filter by

notOptional
or
string[]Optional
allowFuzzyNameFilterbooleanOptional

Set to true to disable fuzzy name filtering. If false, only returns exact matches.

Default: false
tagFilterany ofOptional

Comma-separated list of tag IDs the resulting game objects must have

notOptional
or
string[]Optional
tagExcludeFilterany ofOptional

Comma-separated list of tag IDs to exclude from the response. Use this to exclude game objects that have a specific tag, even if they match the requiredTags filter.

notOptional
or
string[]Optional
untaggedFilterstring · enumOptional

include: Include all game objects, regardless of whether they have tags or not.

exclude: Exclude game objects that have no tags.

untagged-only: Only return game objects that have no tags. Setting this option will ignore requiredTags and excludeTags, since tagged items shouldn't appear in the results.

Default: includePossible values:
excludeGameObjectsany ofOptional

Comma-separated list of Game Object IDs to exclude from the response

notOptional
or
string[]Optional
Responses
200
Successful response
application/json
default
Error response
application/json
get
GET /api/game-objects/count HTTP/1.1
Host: 
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "count": 1
}

Get Game Object by ID

get

Get a Game Object by its 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
default
Error response
application/json
get
GET /api/game-objects/{id} HTTP/1.1
Host: 
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "gameObject": {
    "id": "text",
    "name": "text",
    "description": "text",
    "createdAt": "text",
    "updatedAt": "text",
    "tags": [
      {
        "id": "text",
        "name": "text"
      }
    ],
    "related": [
      "text"
    ]
  }
}
  • GETGet Ranked Results
  • GETGet All Game Objects
  • POSTCreate Game Object
  • DELETEDelete Game Objects
  • GETGet Game Object Count
  • GETGet Game Object by ID
  • PUTUpdate Game Object by ID

Create Game Object

post

Create a new Game Object

Authorizations
Body
idstringOptional

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

Pattern: ^[a-zA-Z0-9_-]+$
namestringRequired
descriptionstringOptional
Responses
200
Successful response
application/json
default
Error response
application/json
post
POST /api/game-objects HTTP/1.1
Host: 
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 71

{
  "id": "text",
  "name": "text",
  "description": "text",
  "tags": [
    {
      "id": "text"
    }
  ]
}
{
  "createdGameObject": {
    "id": "text",
    "name": "text",
    "description": "text",
    "createdAt": "text",
    "updatedAt": "text"
  }
}

Update Game Object by ID

put

Update a Game Object by its 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
default
Error response
application/json
put
PUT /api/game-objects/{id} HTTP/1.1
Host: 
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 73

{
  "data": {
    "id": "text",
    "name": "text",
    "description": "text",
    "tags": [
      "text"
    ]
  }
}
{
  "updatedGameObject": {
    "id": "text",
    "name": "text",
    "description": "text",
    "createdAt": "text",
    "updatedAt": "text"
  }
}