Update entities

This page describes how to update a custom entity using the Management API.

For more information about the Entity Detection feature, see Entity Detection.


Entity Detection - Management API

This section provides a basic example of how to update a custom entity using the Management API.

Authentication

These requests require an access token, as described in Authenticate.

Update an entity

To update a custom entity, use the PUT <https://api.symbl.ai/v1/manage/entity/{entityId}> operation.

import fetch from 'node-fetch';

const accessToken = '<ACCESS_TOKEN>';
const entityParams = {
  'type': '<TYPE>',
  'subType': '<SUBTYPE>',
  'category': 'Custom',
  'values': [
    '<ENTITY_VOCAB>',
    '<ENTITY_VOCAB>',
    ...
  ]
}

const fetchResponse = await fetch('https://api.symbl.ai/v1/manage/entity/${entityId}', {
  method: 'put',
  body: JSON.stringify(entityParams),
  headers: {
    'Authorization': `Bearer ${accessToken}`,
    'Content-Type': 'application/json'
  }
});

const responseBody = await fetchResponse.json();

console.log(responseBody);

Where:

  • <ACCESS_TOKEN> is a valid API access token.
  • <TYPE> describes the type of entity. For example, Vehicle. You can have multiple entities of the same type.
  • <SUBTYPE> describes a subset of the entity. For example, TeslaModel. Subtypes must be unique for each type of entity. For example, there may be only one TeslaModel subtype for the Vehicle type.
  • <ENTITY_VOCAB> is a string to match in a conversation. The vocabulary you provide only returns entities if the string exactly matches a word or phrase in a conversation. For example, ["Model X", "Model S", "Model 3", "Model Y"].

For additional details about the request body parameters for this request, see Request body parameters.

Request body parameters

The following table describes the body parameters that can be used with this request.

ParameterRequiredDescription
typeYesThe type of custom entity. Multiple entities can have the same type.
subTypeYesThe subtype of the custom entity. Subtypes for a type must be unique.
categoryYesThe value must be Custom.
valuesYesA list of vocabulary for the custom entity. Custom entities are identified only if they exactly match the vocabulary in values.

Response

The following table describes the response body that is returned by this request.

FieldDescription
idThe unique identifier of the custom entity. You can use the ID to get and delete the custom entity.
typeThe type of the custom entity.
subTypeThe subtype of the custom entity.
categoryThe value is Custom.
valuesThe list of vocabulary for the custom entity.

Example response

{
  "id": "4476908732794496",
  "type": "Vehicle",
  "subType": "TeslaModel",
  "category": "Custom",
  "values": [
    "Model X",
    "Model S",
    "Model 3",
    "Model Y"
  ]
}

Did this page help you?