Skip to main content
A Database is a template for a kind of Entity: Bugs, Teams, Objectives, etc. It consists of metadata and Fields. 2024-01-12 12.43.42.gif
The API uses type for Database and app for Space. See Terminology.

Database and Field permissions

Imagine you’ve got a Database Task with a Field called Effort. Here’s how permissions apply depending on secured? parameter:
Task secured?
Effort secured?Everyone has access to all fieldsEveryone has access to Effort, but not to other secured? fields
Everyone has access to all fieldsEveryone has access to Task’s non-secured Fields like Id, but permissions are applied to Effort

Create Database

Every Database is a part of some Space. If the Database’s Space does not exist yet, create or install the Space. To create a fully functional Database, we’ll execute two commands:
  1. schema.type/create to create a Database with at least five mandatory primitive Fields:
  • fibery/id
  • fibery/public-id
  • fibery/creation-date
  • fibery/modification-date
  • ${space}/name
  1. fibery.app/install-mixins to be able to prioritize the Database’s Entities.
For auxiliary Databases, that are hidden from Workspace Map screen, ${space}/name Field and rank Mixin are optional. Just skip these parts when creating a Database. Auxiliary Databases might be useful as an Entity-based storage — that’s how our User’s favourite pages and recent items work, for example.
const response = await fetch('https://YOUR_ACCOUNT.fibery.io/api/commands', {
  method: 'POST',
  headers: {
    'Authorization': 'Token YOUR_TOKEN',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    command: 'fibery.schema/batch',
    args: {
      commands: [
        {
          command: 'schema.type/create',
          args: {
            'fibery/name': 'Cricket/Player',
            'fibery/meta': {
              'fibery/domain?': true,
              'fibery/secured?': true,
              'ui/color': '#F7D130'
            },
            'fibery/fields': [
              {
                'fibery/name': 'Cricket/name',
                'fibery/type': 'fibery/text',
                'fibery/meta': {
                  'fibery/secured?': false,
                  'ui/title?': true
                }
              },
              {
                'fibery/name': 'fibery/id',
                'fibery/type': 'fibery/uuid',
                'fibery/meta': {
                  'fibery/secured?': false,
                  'fibery/id?': true,
                  'fibery/readonly?': true
                }
              },
              {
                'fibery/name': 'fibery/public-id',
                'fibery/type': 'fibery/text',
                'fibery/meta': {
                  'fibery/secured?': false,
                  'fibery/public-id?': true,
                  'fibery/readonly?': true
                }
              },
              {
                'fibery/name': 'fibery/creation-date',
                'fibery/type': 'fibery/date-time',
                'fibery/meta': {
                  'fibery/secured?': false,
                  'fibery/creation-date?': true,
                  'fibery/readonly?': true,
                  'fibery/default-value': '$now'
                }
              },
              {
                'fibery/name': 'fibery/modification-date',
                'fibery/type': 'fibery/date-time',
                'fibery/meta': {
                  'fibery/modification-date?': true,
                  'fibery/required?': true,
                  'fibery/readonly?': true,
                  'fibery/default-value': '$now',
                  'fibery/secured?': false
                }
              },
              {
                'fibery/name': 'user/salary',
                'fibery/type': 'fibery/int',
                'fibery/meta': {
                  'fibery/secured?': true
                }
              }
            ]
          }
        },
        {
          command: 'fibery.app/install-mixins',
          args: {
            types: {
              'Cricket/Player': ['fibery/rank-mixin']
            }
          }
        }
      ]
    }
  })
});
const data = await response.json();
Response:
{
  "success": true,
  "result": "ok"
}

Command parameters

Parameter (required in bold)DefaultDescriptionExample
fibery/nameDatabase name in ${space}/${name} formatCRM/Lead
fibery/idAuto-generatedUUIDfd5d9550-3779...
meta.fibery/domain?falseDomain Databases are available as cards on Viewstrue
meta.fibery/secured?Permissions apply to secured Databases onlytrue
meta.ui/color?#000000HEX color to use in Entity badges#F7D130
meta.fibery/fieldsArray of Fields including 5 primitive ones above

Rename Database

const response = await fetch('https://YOUR_ACCOUNT.fibery.io/api/commands', {
  method: 'POST',
  headers: {
    'Authorization': 'Token YOUR_TOKEN',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    command: 'fibery.schema/batch',
    args: {
      commands: [
        {
          command: 'schema.type/rename',
          args: {
            'from-name': 'Cricket/Referee',
            'to-name': 'Cricket/Umpire'
          }
        }
      ]
    }
  })
});
const data = await response.json();
Response:
{
  "success": true,
  "result": "ok"
}

Command parameters

Parameter (required in bold)DescriptionExample
from-nameCurrent Database name in ${space}/${name} formatCricket/Referee
to-nameNew Database name in ${space}/${name} formatCricket/Umpire

Delete Database

const response = await fetch('https://YOUR_ACCOUNT.fibery.io/api/commands', {
  method: 'POST',
  headers: {
    'Authorization': 'Token YOUR_TOKEN',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    command: 'fibery.schema/batch',
    args: {
      commands: [
        {
          command: 'schema.type/delete',
          args: {
            name: 'Cricket/Umpire',
            'delete-entities?': true,
            'delete-related-fields?': true
          }
        }
      ]
    }
  })
});
const data = await response.json();
Response:
{
  "success": true,
  "result": "ok"
}

Command parameters

Parameter (required in bold)DefaultDescriptionExample
nameDatabase name in ${space}/${name} formatCricket/Umpire
delete-entities?falseDelete all Entities of this Database? See the behavior in the table below.true
delete-related-fields?falseDelete all related Fields like Criket/Favourite Umpire in Cricket/Player? See the behavior in the table below.true

delete? parameter behavior

delete? parameter
falsetrue
Entities (or related Fields)don’t existDatabase is deletedDatabase is deleted
existError is thrownDatabase and Entities (or related Fields) are deleted
Related single-select enum Databases are not deleted even with delete-related-fields? enabled. Delete these Databases separately the same way you delete the original Database.