Relation field
- cURL
- JSON
curl -X POST https://api.tapeapp.com/v1/app/ \
-H "Authorization: Bearer $TAPE_TOKEN" \
-H "Content-Type: application/json" \
--data '{
"workspace_id": 1,
"name": "Development-Issues",
"item_name": "Issue",
"fields": [
{
"field_type": "single_relation",
"config": {
"label": "Belongs to Epic",
"description": "The epic this issue belongs to.",
"required": true,
"settings": {
"referenced_apps": [
{
"app_id": 2
}
]
}
}
}
]
}'
{
"workspace_id": 1,
"name": "Development-Issues",
"item_name": "Issue",
"fields": [
{
"field_type": "single_relation",
"config": {
"label": "Belongs to Epic",
"description": "The epic this issue belongs to.",
"required": true,
"settings": {
"referenced_apps": [
{
"app_id": 2
}
]
}
}
}
]
}
{
"app_id": 1,
"workspace_id": 1,
"slug": "development-issues",
"external_id": "development-issues",
"name": "Development-Issues",
"record_name": "Issue",
"item_name": "Issue",
"type": "database",
"config": {
"item_name": "Issue",
"name": "Development-Issues"
},
"fields": [
{
"field_id": 1,
"external_id": "belongs_to_epic",
"slug": "belongs_to_epic",
"label": "Belongs to Epic",
"type": "app",
"field_type": "single_relation",
"config": {
"label": "Belongs to Epic",
"slug": "belongs_to_epic",
"external_id": "belongs_to_epic",
"description": "The epic this issue belongs to.",
"show_description": false,
"required": true,
"always_hidden": false,
"hidden_if_empty": false,
"primary": true,
"settings": {
"multiple": false,
"referenced_apps": [
{
"app_id": 2,
"app": {
"app_id": 2,
"icon": "event_available",
"name": "Epics",
"slug": "epics",
"external_id": "epics",
"record_name": "Epic",
"item_name": "Epic",
"workspace_id": 1,
"config": {
"name": "Epics",
"icon": "event_available",
"record_name": "Epic",
"workspace_id": 1
}
}
}
]
}
}
}
]
}
- cURL
- JSON
curl -X PUT https://api.tapeapp.com/v1/app/1 \
-H "Authorization: Bearer $TAPE_TOKEN" \
-H "Content-Type: application/json" \
--data '{
"fields": [
{
"field_id": 1,
"config": {
"label": "Belongs to",
"description": "The epic or sprint this issue belongs to.",
"required": true,
"settings": {
"referenced_apps": [
{
"app_id": 2,
"view_id": 4
},
{
"app_id": 3,
"view_id": 5
}
]
}
}
}
]
}'
{
"fields": [
{
"field_id": 1,
"config": {
"label": "Belongs to",
"description": "The epic or sprint this issue belongs to.",
"required": true,
"settings": {
"referenced_apps": [
{
"app_id": 2,
"view_id": 4
},
{
"app_id": 3,
"view_id": 5
}
]
}
}
}
]
}
{
"app_id": 1,
"workspace_id": 1,
"slug": "development-issues",
"external_id": "development-issues",
"name": "Development-Issues",
"record_name": "Issue",
"item_name": "Issue",
"type": "database",
"config": {
"item_name": "Issue",
"name": "Development-Issues"
},
"fields": [
{
"field_id": 1,
"external_id": "belongs_to_epic",
"slug": "belongs_to_epic",
"label": "Belongs to",
"type": "app",
"field_type": "single_relation",
"config": {
"label": "Belongs to",
"slug": "belongs_to_epic",
"external_id": "belongs_to_epic",
"description": "The epic or sprint this issue belongs to.",
"show_description": true,
"required": true,
"always_hidden": false,
"hidden_if_empty": false,
"primary": true,
"settings": {
"multiple": false,
"referenced_apps": [
{
"app_id": 2,
"view_id": 4,
"app": {
"app_id": 2,
"icon": "event_available",
"name": "Epics",
"slug": "epics",
"external_id": "epics",
"record_name": "Epic",
"item_name": "Epic",
"workspace_id": 1,
"config": {
"name": "Epics",
"icon": "event_available",
"record_name": "Epic",
"workspace_id": 1
}
}
},
{
"app_id": 3,
"view_id": 5,
"app": {
"app_id": 3,
"icon": "event_available",
"name": "Sprints",
"slug": "sprints",
"external_id": "sprints",
"record_name": "Sprint",
"item_name": "Sprint",
"workspace_id": 1,
"config": {
"name": "Sprints",
"icon": "event_available",
"record_name": "Sprint",
"workspace_id": 1
}
}
}
]
}
}
}
]
}
Use a relation field to link a record to records of other database apps.
Tape has two relation field types. Both are the Relation field in Tape:
single_relationholds one related record.multi_relationholds several related records.
A relation field has the common field properties and settings with the apps it can link to. To read and write the related records of a record, see Relation field value.
{
"field_id": 1,
"external_id": "belongs_to_epic",
"slug": "belongs_to_epic",
"label": "Belongs to Epic",
"type": "app",
"field_type": "single_relation",
"config": {
"label": "Belongs to Epic",
"slug": "belongs_to_epic",
"external_id": "belongs_to_epic",
"description": "The epic this issue belongs to.",
"show_description": true,
"required": true,
"always_hidden": false,
"hidden_if_empty": false,
"primary": false,
"settings": {
"multiple": false,
"referenced_apps": [
{
"app_id": 2,
"app": {
"app_id": 2,
"icon": "event_available",
"name": "Epics",
"slug": "epics",
"external_id": "epics",
"record_name": "Epic",
"item_name": "Epic",
"workspace_id": 1,
"config": {
"name": "Epics",
"icon": "event_available",
"record_name": "Epic",
"workspace_id": 1
}
}
}
]
}
}
}
typestring
"app" for both relation field types.
field_typestring
"single_relation" or "multi_relation".
config.settings.multiple (read-only)boolean
false for single_relation, true for multi_relation.
config.settings.referenced_appsarray
The apps whose records the field can link to.
config.settings.referenced_apps[].app_idnumber
ID of a linked app. Required when you create or change the field. See Where do I find the app ID?.
config.settings.referenced_apps[].view_idnumber
ID of a view of the linked app. Its filters limit the records you can select in Tape. Appears only if the field has a view.
config.settings.referenced_apps[].app (read-only)object
A short preview of the linked app with app_id, icon, name, slug, record_name, workspace_id and config. external_id and item_name repeat slug and record_name for older integrations.
| Property | Type | Description | Example value |
|---|---|---|---|
type | string | "app" for both relation field types. | "app" |
field_type | string | "single_relation" or "multi_relation". | "single_relation" |
config.settings.multiple (read-only) | boolean | false for single_relation, true for multi_relation. | false |
config.settings.referenced_apps | array | The apps whose records the field can link to. | |
config.settings.referenced_apps[].app_id | number | ID of a linked app. Required when you create or change the field. See Where do I find the app ID?. | 2 |
config.settings.referenced_apps[].view_id | number | ID of a view of the linked app. Its filters limit the records you can select in Tape. Appears only if the field has a view. | 5 |
config.settings.referenced_apps[].app (read-only) | object | A short preview of the linked app with app_id, icon, name, slug, record_name, workspace_id and config. external_id and item_name repeat slug and record_name for older integrations. |
Find the view IDs with Retrieve views for an app. Create and change views with the view endpoints or in Tape.
App creation
Use the create app endpoint to create relation fields together with a new app.
/v1/appapi.tapeapp.com- cURL
- JSON
curl -X POST https://api.tapeapp.com/v1/app/ \
-H "Authorization: Bearer $TAPE_TOKEN" \
-H "Content-Type: application/json" \
--data '{
"workspace_id": 1,
"name": "Development-Issues",
"item_name": "Issue",
"fields": [
{
"field_type": "single_relation",
"config": {
"label": "Belongs to Epic",
"description": "The epic this issue belongs to.",
"required": true,
"settings": {
"referenced_apps": [
{
"app_id": 2
}
]
}
}
}
]
}'
{
"workspace_id": 1,
"name": "Development-Issues",
"item_name": "Issue",
"fields": [
{
"field_type": "single_relation",
"config": {
"label": "Belongs to Epic",
"description": "The epic this issue belongs to.",
"required": true,
"settings": {
"referenced_apps": [
{
"app_id": 2
}
]
}
}
}
]
}
{
"app_id": 1,
"workspace_id": 1,
"slug": "development-issues",
"external_id": "development-issues",
"name": "Development-Issues",
"record_name": "Issue",
"item_name": "Issue",
"type": "database",
"config": {
"item_name": "Issue",
"name": "Development-Issues"
},
"fields": [
{
"field_id": 1,
"external_id": "belongs_to_epic",
"slug": "belongs_to_epic",
"label": "Belongs to Epic",
"type": "app",
"field_type": "single_relation",
"config": {
"label": "Belongs to Epic",
"slug": "belongs_to_epic",
"external_id": "belongs_to_epic",
"description": "The epic this issue belongs to.",
"show_description": false,
"required": true,
"always_hidden": false,
"hidden_if_empty": false,
"primary": true,
"settings": {
"multiple": false,
"referenced_apps": [
{
"app_id": 2,
"app": {
"app_id": 2,
"icon": "event_available",
"name": "Epics",
"slug": "epics",
"external_id": "epics",
"record_name": "Epic",
"item_name": "Epic",
"workspace_id": 1,
"config": {
"name": "Epics",
"icon": "event_available",
"record_name": "Epic",
"workspace_id": 1
}
}
}
]
}
}
}
]
}
The example creates an issues app in the workspace with ID 1. The app gets a single_relation field "Belongs to Epic" that links to the "Epics" app with ID 2. Create a multi_relation field the same way.
Find the workspace ID with Retrieve workspaces.
General behavior
- Each object in
referenced_appsneeds anapp_id.view_idis optional and must be a number. - Without
primary, Tape makes the first field of the request the primary field. Here, that's "Belongs to Epic". - A new relation field doesn't show its
descriptionas help text yet (show_descriptionisfalse). To show it, send thedescriptionagain in a field update.
Requirements: apps:edit, a workspace role that may edit apps in the workspace, and at least Can view access to the linked apps. Works with a personal access token, an OAuth access token or a user API key.
Errors
- A mix of linked apps with and without
view_idinreferenced_appsreturns400with the messageView with id undefined does not exist. If one linked app has aview_id, every linked app needs one.
App update
Use the update app endpoint to create new relation fields in an app or to change existing ones.
/v1/app/{appId}api.tapeapp.com- cURL
- JSON
curl -X PUT https://api.tapeapp.com/v1/app/1 \
-H "Authorization: Bearer $TAPE_TOKEN" \
-H "Content-Type: application/json" \
--data '{
"fields": [
{
"field_id": 1,
"config": {
"label": "Belongs to",
"description": "The epic or sprint this issue belongs to.",
"required": true,
"settings": {
"referenced_apps": [
{
"app_id": 2,
"view_id": 4
},
{
"app_id": 3,
"view_id": 5
}
]
}
}
}
]
}'
{
"fields": [
{
"field_id": 1,
"config": {
"label": "Belongs to",
"description": "The epic or sprint this issue belongs to.",
"required": true,
"settings": {
"referenced_apps": [
{
"app_id": 2,
"view_id": 4
},
{
"app_id": 3,
"view_id": 5
}
]
}
}
}
]
}
{
"app_id": 1,
"workspace_id": 1,
"slug": "development-issues",
"external_id": "development-issues",
"name": "Development-Issues",
"record_name": "Issue",
"item_name": "Issue",
"type": "database",
"config": {
"item_name": "Issue",
"name": "Development-Issues"
},
"fields": [
{
"field_id": 1,
"external_id": "belongs_to_epic",
"slug": "belongs_to_epic",
"label": "Belongs to",
"type": "app",
"field_type": "single_relation",
"config": {
"label": "Belongs to",
"slug": "belongs_to_epic",
"external_id": "belongs_to_epic",
"description": "The epic or sprint this issue belongs to.",
"show_description": true,
"required": true,
"always_hidden": false,
"hidden_if_empty": false,
"primary": true,
"settings": {
"multiple": false,
"referenced_apps": [
{
"app_id": 2,
"view_id": 4,
"app": {
"app_id": 2,
"icon": "event_available",
"name": "Epics",
"slug": "epics",
"external_id": "epics",
"record_name": "Epic",
"item_name": "Epic",
"workspace_id": 1,
"config": {
"name": "Epics",
"icon": "event_available",
"record_name": "Epic",
"workspace_id": 1
}
}
},
{
"app_id": 3,
"view_id": 5,
"app": {
"app_id": 3,
"icon": "event_available",
"name": "Sprints",
"slug": "sprints",
"external_id": "sprints",
"record_name": "Sprint",
"item_name": "Sprint",
"workspace_id": 1,
"config": {
"name": "Sprints",
"icon": "event_available",
"record_name": "Sprint",
"workspace_id": 1
}
}
}
]
}
}
}
]
}
The example changes the field "Belongs to Epic" (ID 1) of the issues app. It renames the field to "Belongs to" and adds the "Sprints" app with ID 3. The views with ID 4 for "Epics" and ID 5 for "Sprints" limit the records you can select.
Change a multi_relation field the same way. Find the app ID and the field IDs in the Developer view of the app.
General behavior
- A field with
field_idupdates that field. A field withoutfield_idcreates a new field and needs afield_type. - Send all linked apps in
referenced_apps, not only the ones you add. Tape removes linked apps that aren't in the request. - Without
settings, Tape removes all linked apps of the field. - Renaming a field keeps its
slug. The renamed field "Belongs to" still has the slugbelongs_to_epic. - Send
required,always_hidden,hidden_if_emptyanddescriptionwith every field you update. Tape sets left-out switches tofalseand hides the help text withoutdescription. See Create and update fields. - Fields that aren't in the request stay unchanged.
Requirements: apps:edit, Full access to the app, and at least Can view access to the linked apps. Works with a personal access token, an OAuth access token or a user API key.
Errors
- Every field you update needs
config.label, even if the label stays the same. Without it, Tape rejects the request with400andinput_validation. The message reads, for example,Invalid input: data/fields/0/config must have required property 'label'. - A mix of linked apps with and without
view_idinreferenced_appsreturns400with the messageView with id undefined does not exist. If one linked app has aview_id, every linked app needs one.
Next steps
read and write the related records of a record.
search for records you can add to a relation field.
create the views that limit the records you can select.
the properties all field types share.
create, update and delete apps with their fields.
what apps:edit allows.