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

Export/Import

PreviousAdminNextCommand Line Interface (CLI)

Was this helpful?

  • GETExport Data
  • POSTImport Data

Export Data

get

Get exported 2bttns data.

You can choose to export all data or only the data you need from the Game, Tag, and Game Object database tables used by 2bttns.

Supports JSON format.

Authorizations
Query parameters
includeGamesbooleanOptional

Set to true to export Games.

The Game data will include associated Tag IDs if includeTags is true

Default: true
includeGameObjectsbooleanOptional

Set to true to export Game Objects.

The GameObject data will include associated Tag IDs if includeTags is true

Default: true
includeTagsbooleanOptional

Set to true to export Tags.

Default: true
countstring · enumOptional

include: include the count of each type of data exported with the results

count-only: only return the count of each type of data that would be exported. Useful if you only want the count and not the actual data.

no-count: do not include the count

Default: includePossible values:
filterGameIdsany ofOptional

Comma-separated ID list of Games to export.

Leave this field empty if you want the results to include all Games.

notOptional
or
string[]Optional
filterGameObjectIdsany ofOptional

Comma-separated ID list of GameObjects to export.

Leave this field empty if you want the results to include all GameObjects.

notOptional
or
string[]Optional
filterAllowUntaggedGameObjectsbooleanOptional

Set to false to exclude GameObjects that have no tags.

Default: true
filterTagIdsany ofOptional

Comma-separated ID list of Tags to export.

Leave this field empty if you want the results to include all Tags.

notOptional
or
string[]Optional
filterTagsMustBeInGamesbooleanOptional

Set to true to only include Tags that are associated with the games that are being exported.

Default: false
filterTagsMustBeInGameObjectsbooleanOptional

Set to true to only include Tags that are associated with the game objects that are being exported.

Default: false
Responses
200
Successful response
application/json
default
Error response
application/json
get
GET /api/export-data HTTP/1.1
Host: 
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "count": {
    "games": 1,
    "gameObjects": 1,
    "tags": 1
  },
  "games": [
    {
      "id": "text",
      "name": "text",
      "description": "text",
      "inputTagIds": [
        "text"
      ]
    }
  ],
  "gameObjects": [
    {
      "id": "text",
      "name": "text",
      "description": "text",
      "tagIds": [
        "text"
      ]
    }
  ],
  "tags": [
    {
      "id": "text",
      "name": "text",
      "description": "text"
    }
  ]
}

Import Data

post

Import 2bttns data from a JSON file.

Authorizations
Body
jsonBase64stringRequired

Base64 encoded JSON file to import

allOrNothingbooleanOptional

If true, the import will fail if any part of it fails.

If false, the import will continue even if some parts fail.

Default: false
generateNewIdsbooleanOptional

Generate new IDs for imported data and remap all references to them, instead of using existing IDs.

This may result in duplicate entries with similar content but different IDs.

Default: false
Responses
200
Successful response
application/json
default
Error response
application/json
post
POST /api/import-data HTTP/1.1
Host: 
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 65

{
  "jsonBase64": "text",
  "allOrNothing": false,
  "generateNewIds": false
}
{
  "results": {
    "tags": {
      "successes": 1,
      "failures": 1
    },
    "gameObjects": {
      "successes": 1,
      "failures": 1
    },
    "games": {
      "successes": 1,
      "failures": 1
    }
  },
  "allOrNothingFailed": true,
  "logMessages": [
    {
      "type": "info",
      "message": "text"
    }
  ]
}