Skip to main content

Unique-Id Field

There is only type of unique_id field: unique_id.

unique_id fields cannot be set manually, but are automatically generated by Tape. They are used to uniquely identify records within an app. The first record of an app will have the unique_id "1", the second record "2", etc.

In addition to the common field properties, a unique_id field has the following settings:

  • min_digits (optional): minimum number of digits of the unique_id field-values. Can be any integer between 1 and 12. (default: 1). In case the number of digits of the unique_id field-value is smaller than min_digits, the unique_id field-value will be padded with leading zeros.
  • prefix (optional): prefix of the unique_id field-values. Can be any string, e.g. "DEAL-" for tickets, "Ticket-" for tickets, etc.

Currently, unique_id field values are not returned in the API responses of the record endpoints. However, they can be used for viewing, searching for and filtering records in the web-application. The unique_id value (without its prefix) however is returned as the property app_record_id in the API responses of the record endpoints.

App creation

POSThttps://api.tapeapp.com/v1/app

A unique_id field can be created as part of an App creation. Here is an example request body for creating an excerpt for a Tickets app within a workspace with ID 1. The app contains a unique_id field "Ticket-ID". Other useful fields for a tickets app, like "Title", "Status" or "Description" are omitted for brevity.

➡️    Request

curl -X POST https://api.tapeapp.com/v1/app/ \
-u user_key_replace_with_your_api_key: \
-H "Content-Type: application/json" \
--data '{
"workspace_id": 1,
"name": "Tickets",
"item_name": "Ticket",
"fields": [
{
"field_type": "unique_id",
"config": {
"label": "Ticket-ID",
"settings": {
"min_digits": 4,
"prefix": "Ticket-"
}
}
}
]
}'
⬅️    Response
{
"app_id": 1,
"workspace_id": 1,
"slug": "tickets",
"name": "Tickets",
"item_name": "Ticket",
"position": 0,
"config": {
"item_name": "Ticket",
"name": "Tickets"
},
"fields": [
{
"field_id": 1,
"slug": "ticket_id",
"label": "Ticket-ID",
"type": "unique_id",
"field_type": "unique_id",
"config": {
"label": "Ticket-ID",
"slug": "ticket_id",
"always_hidden": false,
"hidden_if_empty": false,
"settings": {
"prefix": "Ticket-",
"min_digits": 4
}
}
}
]
}

App update

PUThttps://api.tapeapp.com/v1/app/{appId}

A unique_id field can be created or updated as part of an App update. Here is an example request body for updating the previously created tickets app with ID 1. The update sets the min_digits to 5.

➡️    Request

curl -X PUT https://api.tapeapp.com/v1/app/1 \
-u user_key_replace_with_your_api_key: \
-H "Content-Type: application/json" --data '{
"app_id": 1,
"name": "Tickets",
"item_name": "Ticket",
"fields": [
{
"field_id": 1,
"config": {
"label": "Ticket-ID",
"settings": {
"min_digits": 5,
"prefix": "Ticket-"
}
}
}
]
}'
⬅️    Response
{
"app_id": 1,
"workspace_id": 1,
"slug": "tickets",
"name": "Tickets",
"item_name": "Ticket",
"position": 0,
"config": {
"item_name": "Ticket",
"name": "Tickets"
},
"fields": [
{
"field_id": 1,
"slug": "ticket_id",
"label": "Ticket-ID",
"type": "unique_id",
"field_type": "unique_id",
"config": {
"label": "Ticket-ID",
"slug": "ticket_id",
"required": false,
"always_hidden": false,
"hidden_if_empty": false,
"settings": {
"prefix": "Ticket-",
"min_digits": 5
}
}
}
]
}```