Database

Create New Database

POST databases/

Note

Authorized Roles: root, manager

This endpoint allows you to create a new database.

Request JSON Object
  • name (string) – Database name

  • description (string) – Database long description

  • item_id_type (string) – [see Flexible Identifiers] Item ID type

  • user_id_type (string) – [see Flexible Identifiers] User ID type

EXAMPLE QUERY BODY
  {
      "name": "Example DB name",
      "description": "Example DB longer description",
      "item_id_type": "uuid",
      "user_id_type": "uint32"
  }
Response JSON Object
  • id (string) – Database ID

EXAMPLE RESPONSE
  {
      "id": "wSSZQbPxKvBrk_n2B_m6ZA"
  }

Errors:

  • DuplicatedError with error name DUPLICATED_DB_NAME if a database with the same name already exists

List All Databases

GET databases/

Note

Authorized Roles: root, manager, backend

This endpoint allows you to get all databases for the organization you’re logged to with your current token. The result is paginated.

Query Parameters
  • page (int) – Optional. [min: 1] Page to be listed.

  • amt (int) – Optional. [min: 1 max: 64] Amount of databases to return

EXAMPLE QUERY PARAMS
  ?page=1&amt=10
Response JSON Object
  • has_next (bool) – Indicates whether or not there are more pages to request

  • next_page (int) – Next page to request

  • databases (list-of-object) –

    Databases page

    Inner fields:

    • status (string) – either “pending” or “ready”

    • id (string) – Database ID

    • name (string) – Database name

    • description (string) – Database long description

    • item_id_type (string) – [see Flexible Identifiers] Item ID type

    • user_id_type (string) – [see Flexible Identifiers] User ID type

EXAMPLE RESPONSE
  {
      "has_next": false,
      "next_page": 2,
      "databases": [
          {
              "id": "wSSZQbPxKvBrk_n2B_m6ZA",
              "name": "Example DB name",
              "description": "Example DB longer description",
              "item_id_type": "uuid",
              "user_id_type": "uint32",
              "status": "ready"
          }
      ]
  }

Get Current Database

GET databases/current/

Note

Authorized Roles: root, manager, backend

This endpoint allows you to get the metadata for the database you’re logged to with your current token.

Response JSON Object
  • status (string) – either “pending” or “ready”

  • id (string) – Database ID

  • name (string) – Database name

  • description (string) – Database long description

  • item_id_type (string) – [see Flexible Identifiers] Item ID type

  • user_id_type (string) – [see Flexible Identifiers] User ID type

  • counters (object) –

    Inner fields:

    • rating (int) – Amount of ratings

    • user (int) – Amount of users

    • item (int) – Amount of items

  • metadata (object) – Extra meta data, as unvalidated JSON

EXAMPLE RESPONSE
  {
      "id": "wSSZQbPxKvBrk_n2B_m6ZA",
      "name": "Example DB name",
      "description": "Example DB longer description",
      "item_id_type": "uuid",
      "user_id_type": "uint32",
      "status": "ready",
      "counters": {
          "rating": 130,
          "user": 70,
          "item": 81
      }
  }

Delete Current Database

DELETE databases/current/

Note

Authorized Roles: root, manager

This endpoint allows you to delete the database you’re logged to with your current token. Everything will be deleted: all the items, all the users, all the ratings, all refresh token and all the machine learning models that were created. Note that you cannot undo this operation.

Get Current Database Status

GET databases/current/status/

Note

Authorized Roles: root, manager, backend

Get status of database. Initially the database will be in “pending” status. Until the status switch to “ready” you will not be able to get recommendations.

Response JSON Object
  • status (string) – either “pending” or “ready”

EXAMPLE RESPONSE
  {
      "status": "ready"
  }