Guide
Type is a template for Entities of some kind: Bugs, Teams, Objectives, etc.
In the interface, Type = Database, App = Space. To find out why, check Terminology.
It consists of metadata and Fields.
Type and Field permissions
Imagine you've got a Type Task with a Field called Effort. Here's how permissions apply depending on secured? parameter:
| Task secured? |
❌ | ✅ |
Effort secured? | ❌ | Everyone has access to all fields | Everyone has access to Effort, but not to other secured? fields |
✅ | Everyone has access to all fields | Everyone has access to Task’s non-secured Fields like Id, but permissions are applied to Effort |
Create Type
Every Type is a part of some Space. If Type's Space does not exist yet, create or install the Space.
To create a fully functional Type, we'll execute two commands:
schema.type/create to create a Type with at least five mandatory primitive Fields:
fibery/id
fibery/public-id
fibery/creation-date
fibery/modification-date
${space}/name
fibery.app/install-mixins to be able to prioritize Type's Entities.
For auxiliary Types, that are hidden from Workspace Map screen, ${space}/name Field and rank Mixin are optional. Just skip these parts when creating a Type.
Auxiliary Types might be useful as an Entity-based storage — that's how our User's favourite pages and recent items work, for example.
JavaScript
const Fibery = require('fibery-unofficial');
const fibery = new Fibery({host: "YOUR_ACCOUNT.fibery.io", token: YOUR_TOKEN});
// 5 primitive fields are created and rank Mixin is installed automatically for domain Types
await fibery.type.createBatch([
{
'fibery/name': 'Cricket/Player',
'fibery/meta': {
'fibery/domain?': true,
'fibery/secured?': true,
'ui/color': '#F7D130'
},
'fibery/fields': [
{
"fibery/name": 'user/salary',
"fibery/type": 'fibery/int',
"fibery/meta": {
"fibery/secured?": true
}
}
]
}
]);
cURL
curl -X POST https://YOUR_ACCOUNT.fibery.io/api/commands \
-H 'Authorization: Token YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d \
'
{
"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"
]
}
}
}
]
}
}
'
Result (cURL):
{
"success": true,
"result": "ok"
}
Command parameters
Parameter (required in bold) | Default | Description | Example |
|---|
fibery/name
| | Type name in ${space}/${name} format | CRM/Lead
|
fibery/id
| Auto-generated | UUID | fd5d9550-3779...
|
meta.fibery/domain? | false | Domain Types are available as cards on Views | true |
meta.fibery/secured? | | Permissions apply to secured Types only | true |
meta.ui/color? | #000000 | HEX color to use in Entity badges | #F7D130 |
meta.fibery/fields | | Array of Fields including 5 primitive ones above | |
Rename Type
JavaScript
const Fibery = require('fibery-unofficial');
const fibery = new Fibery({host: "YOUR_ACCOUNT.fibery.io", token: YOUR_TOKEN});
await fibery.type.renameBatch([
{
'from-name': 'Cricket/Referee',
'to-name': 'Cricket/Umpire'
}
]);
cURL
curl -X POST https://YOUR_ACCOUNT.fibery.io/api/commands \
-H 'Authorization: Token YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d \
'
{
"command": "fibery.schema/batch",
"args": {
"commands": [
{
"command": "schema.type/rename",
"args": {
"from-name": "Cricket/Referee",
"to-name": "Cricket/Umpire"
}
}
]
}
}
'
Result (cURL):
{
"success": true,
"result": "ok"
}
Command parameters
Parameter (required in bold) | Description | Example |
|---|
from-name
| Current Type name in ${space}/${name} format | Cricket/Referee
|
to-name
| New Type name in ${space}/${name} format | Cricket/Umpire
|
Delete Type
JavaScript
const Fibery = require('fibery-unofficial');
const fibery = new Fibery({host: "YOUR_ACCOUNT.fibery.io", token: YOUR_TOKEN});
await fibery.type.deleteBatch([
{
'name': 'Cricket/Umpire',
'delete-entities?': true,
'delete-related-fields?': true
}
]);
cURL
curl -X POST https://YOUR_ACCOUNT.fibery.io/api/commands \
-H 'Authorization: Token YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d \
'
{
"command": "fibery.schema/batch",
"args": {
"commands": [
{
"command": "schema.type/delete",
"args": {
"name": "Cricket/Umpire",
"delete-entities?": true,
"delete-related-fields?": true
}
}
]
}
}
'
Result (cURL):
{
"success": true,
"result": "ok"
}
Command parameters
Parameter (required in bold) | Default | Description | Example |
|---|
name
| | Type name in ${space}/${name} format | Cricket/Umpire
|
delete-entities?
| false | Delete all Entities of this Type? See the behavior in the table below. | true |
delete-related-fields?
| false | Delete all related Fields like Criket/Favourite Umpire in Cricket/Player? See the behavior in the table below. | true |
delete? parameter behavior
| delete? parameter
|
false | true |
Entities (or related Fields) | don't exist | Type is deleted | Type is deleted |
exist | Error is thrown | Type and Entities (or related Fields) are deleted |
Related single-select enum Types are not deleted even with delete-related-fields? enabled. Delete these Types separately the same way you delete the original Type.