Category Field Value
A category field value consists of its value property which holds a reference to a category option. A category option has the properties id (unique ID), text (the label) and color (hexcolor value). A single_category field value holds at most one category option while a multi_category field value can hold multiple category options.
Record creation
A category field value can be created as part of a record creation. Here is an example request body for creating a record with a value for the "Salutation" field with ID 2, type single_category and external ID salutation and a value for the "Tags" field with ID 3, type multi_category and external ID tags:
- cURL
 - JSON
 
curl -X POST https://api.tapeapp.com/v1/record/app/1 \
  -u user_key_replace_with_your_api_key: \
  -H "Content-Type: application/json" \
  --data '{
    "fields": {
      "salutation": 1,
      "tags": [4, 5]
    }
  }' 
{
  "fields": {
    "salutation": 1,
    "tags": [4, 5]
  }
}
{
  "record_id": 1,
  "title": "Mr.",
  "fields": [
    {
      "field_id": 2,
      "external_id": "salutation",
      "label": "Salutation",
      "type": "category",
      "field_type": "single_category",
      "values": [
        {
          "value": {
            "id": 1,
            "text": "Mr.",
            "color": "CDCCC9"
          }
        }
      ]
    },
    {
      "field_id": 3,
      "external_id": "tags",
      "label": "Tags",
      "field_type": "multi_category",
      "type": "category",
      "values": [
        {
          "value": {
            "id": 4,
            "color": "CDCCC9",
            "text": "Interview outstanding"
          }
        },
        {
          "value": {
            "id": 5,
            "color": "6E7174",
            "text": "Missing contact details"
          }
        }
      ]
    }
  ]
}
Record retrieval
A category field value can be retrieved as part of a record retrieval:
curl https://api.tapeapp.com/v1/record/1 \
  -u user_key_replace_with_your_api_key:
{
  "record_id": 1,
  "title": "Mr.",
  "fields": [
    {
      "field_id": 2,
      "external_id": "salutation",
      "label": "Salutation",
      "type": "category",
      "field_type": "single_category",
      "values": [
        {
          "value": {
            "id": 1,
            "text": "Mr.",
            "color": "CDCCC9"
          }
        }
      ]
    },
    {
      "field_id": 3,
      "external_id": "tags",
      "label": "Tags",
      "field_type": "multi_category",
      "type": "category",
      "values": [
        {
          "value": {
            "id": 4,
            "color": "CDCCC9",
            "text": "Interview outstanding"
          }
        },
        {
          "value": {
            "id": 5,
            "color": "6E7174",
            "text": "Missing contact details"
          }
        }
      ]
    }
  ]
}
Record update
One or more category field values can be updated as part of a record update. Here is an example request body for updating multiple category field values of a record:
- cURL
 - JSON
 
curl -X PUT https://api.tapeapp.com/v1/record/1 \
  -u user_key_replace_with_your_api_key: \
  -H "Content-Type: application/json" \
  --data '{
    "fields": {
      "salutation": 2,
      "tags": [5]
    }
  }' 
{
  "fields": {
    "salutation": 2,
    "tags": [5]
  }
}
{
  "record_id": 1,
  "title": "Mrs.",
  "fields": [
    {
      "field_id": 2,
      "external_id": "salutation",
      "label": "Salutation",
      "type": "category",
      "field_type": "single_category",
      "values": [
        {
          "value": {
            "id": 2,
            "text": "Mrs.",
            "color": "DC0080"
          }
        }
      ]
    },
    {
      "field_id": 3,
      "external_id": "tags",
      "label": "Tags",
      "field_type": "multi_category",
      "type": "category",
      "values": [
        {
          "value": {
            "id": 5,
            "color": "6E7174",
            "text": "Missing contact details"
          }
        }
      ]
    }
  ]
}