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

  • session_id_type (string) – Optional. [see Flexible Identifiers] Anonymous Session ID type

  • core_config (object) – Optional. Internal config

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

EXAMPLE QUERY BODY
  {
      "name": "Example DB name",
      "description": "Example DB longer description",
      "item_id_type": "uuid",
      "user_id_type": "uint32"
  }
Response JSON Object
  • warnings (list-of-string) – Optional. List of warnings

  • 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
  • warnings (list-of-string) – Optional. List of warnings

  • 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
    • 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

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

    • session_id_type (string) – [see Flexible Identifiers] Anonymous Session 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",
              "session_id_type": "uuid",
              "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
  • 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

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

  • session_id_type (string) – [see Flexible Identifiers] Anonymous Session ID type

  • warnings (list-of-string) – Optional. List of warnings

  • org_id (string) – Organization ID

  • counters (object) –

    Inner fields
    • warnings (list-of-string) – List of warnings

    • rating (int) – Amount of ratings

    • user (int) – Amount of users

    • item (int) – Amount of items

  • core_config (object) – Internal config

  • 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",
      "session_id_type": "uuid",
      "status": "ready",
      "counters": {
          "rating": 130,
          "user": 70,
          "item": 81
      },
      "org_id": "WEdZJsRxKvBrn2B_m6ZA",
      "metadata": {
          "custom-int": 1,
          "custom-dict": {
              "a": 1,
              "b": 2
          }
      }
  }

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
  • warnings (list-of-string) – Optional. List of warnings

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

EXAMPLE RESPONSE
  {
      "status": "ready"
  }