Skip to main content
The API uses type for Database and app for Space. See Terminology.

Create Entity

Create Entities with primitive, single-select and entity Fields. Setting fibery/id is optional and might be useful for working with Entity right after creation. To set a single-select or an entity Field we’ll need the target Entity’s fibery/id. We can get fibery/id either via API (check Query entities) or by opening the relevant Entity on UI and exploring the command response in browser’s Network tab.
Note that the target related Entity should already exist.
Setting entity collection Fields on Entity creation is not supported. Instead we suggest updating entity collection Fields after the Entity is created — see Collections. Setting a rich text Field on creation is not possible either. Update rich text Field once the Entity is created — see Rich text and comments. Cricket/Player Database used as an example
Field nameField type
fibery/idfibery/uuid
fibery/public-idfibery/text
Cricket/Namefibery/text
Cricket/Full Namefibery/text
Cricket/Bornfibery/date
Cricket/Youth Careerfibery/date-range
Cricket/Shirt Numberfibery/int
Cricket/Heightfibery/decimal
Cricket/Retiredfibery/bool
Cricket/Batting Handsingle-select
Cricket/Current Teamentity Field
Cricket/Former Teamsentity collection Field
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.entity/create',
    args: {
      type: 'Cricket/Player',
      entity: {
        'fibery/id': 'd17390c4-98c8-11e9-a2a3-2a2ae2dbcce4',
        'Cricket/Name': 'Curtly Ambrose',
        'Cricket/Full Name': 'Curtly Elconn Lynwall Ambrose',
        'Cricket/Born': '1963-09-21',
        'Cricket/Youth Career': {
          start: '1985-01-01',
          end: '1986-01-01'
        },
        'Cricket/Shirt Number': 1,
        'Cricket/Height': '2.01',
        'Cricket/Retired': true,

        'Cricket/Batting Hand': { 'fibery/id': 'b0ed3a80-9747-11e9-9f03-fd937c4ecf3b' }
      }
    }
  })
});
const data = await response.json();
Result with all primitive Fields, single-selects and entity Fields:
{
  "success": true,
  "result": {
    "Cricket/Height": "2.01",
    "fibery/modification-date": "2019-06-27T10:44:53.860Z",
    "Cricket/Born": "1963-09-21",
    "fibery/id": "d17390c4-98c8-11e9-a2a3-2a2ae2dbcce4",
    "fibery/creation-date": "2019-06-27T10:44:53.860Z",
    "fibery/created-by": {
      "fibery/id": "fe1db100-3779-11e9-9162-04d77e8d50cb"
    },
    "fibery/rank": 5674304923033269,
    "Cricket/Shirt Number": 1,
    "Cricket/Full Name": "Curtly Elconn Lynwall Ambrose",
    "fibery/public-id": "6",
    "Cricket/Retired": true,
    "Cricket/Current Team": null,
    "Cricket/Batting Hand": {
      "fibery/id": "b0ed3a80-9747-11e9-9f03-fd937c4ecf3b"
    },
    "Cricket/Bio": {
      "fibery/id": "019dd3cd-3810-702d-857b-20fb92d60268"
    },
    "Cricket/Youth Career": {
      "start": "1985-01-01",
      "end": "1986-01-01"
    },
    "Cricket/Name": "Curtly Ambrose"
  }
}

Update Entity

Update primitive, single-select and entity Fields this way. For updating entity collection Fields, see Collections. To update a single-select or an entity Field, we’ll need the target Entity’s fibery/id. We can get fibery/id either via API or by opening the relevant Entity on UI and exploring the command response in browser’s Network tab. Note that the target Entity should already exist. Cricket/Player Database used as an example
Field nameField type
fibery/idfibery/uuid
fibery/public-idfibery/text
Cricket/Namefibery/text
Cricket/Full Namefibery/text
Cricket/Bornfibery/date
Cricket/Youth Careerfibery/date-range
Cricket/Shirt Numberfibery/int
Cricket/Heightfibery/decimal
Cricket/Retiredfibery/bool
Cricket/Batting Handsingle-select
Cricket/Current Teamentity Field
Cricket/Former Teamsentity collection Field
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.entity/update',
    args: {
      type: 'Cricket/Player',
      entity: {
        'fibery/id': '20f9b920-9752-11e9-81b9-4363f716f666',
        'Cricket/Full Name': 'Virat "Chikoo" Kohli',
        'Cricket/Current Team': { 'fibery/id': 'd328b7b0-97fa-11e9-81b9-4363f716f666' }
      }
    }
  })
});
const data = await response.json();
Response:
{
  "success": true,
  "result": {
    "fibery/id": "20f9b920-9752-11e9-81b9-4363f716f666"
  }
}

Delete Entity

Delete an Entity by providing its Database and fibery/id.
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.entity/delete',
    args: {
      type: 'Cricket/Player',
      entity: { 'fibery/id': '93648510-9907-11e9-acf1-fd0d502cdd20' }
    }
  })
});
const data = await response.json();
Response:
{
  "success": true,
  "result": null
}