Custom Metrics in Talkwalker Customer Intelligence project
Talkwalker users can also manage custom metrics in their Customer Intelligence project. The main differences between the endpoints defined in the Talkwalker project and the Talkwalker Customer Intelligence project are the following:
- Extended URL paths containing
dataset_template_id
path parameter - An additional
dataset_template_id
field in responses
note
Custom metrics in Customer Intelligence project are called Custom fields
and are created under dataset templates.
List custom metrics
This endpoint is used to retrieve the list of custom metrics created in your Customer Intelligence project.
curl -x GET 'https://api.talkwalker.com/api/v2/talkwalker/p/<project_id>/dataset_templates/t/<dataset_template_id>/custom_metrics/list?access_token=<access_token>'
{
"result_custom_metrics": {
"dataset_template_id": string,
"data": [
{
"custom_metric": {
"name": string,
"title": string,
"description": string,
"display_in_ui": boolean,
"update_ts": number,
"format": {
"name": "DATE_TIME" | "DECIMAL" | "DURATION" | "INTEGER" | "TEXT" | "KEYWORD" | "CUSTOMIZED",
"metric_type": "UNKNOWN_TYPE" | "LONG" | "DOUBLE" | "TEXT" | "KEYWORD", // ONLY if "name" # "CUSTOMIZED"
"format_type": "PLAIN" | "DATE" | "DATE_TIME" | "DURATION" | "NUMBER_INT" | "NUMBER_FLOAT" | "NUMBER_PERCENTAGE" | "NUMBER_SHORTENED" // ONLY if "name" # "CUSTOMIZED"
}
}
},
...
]
}
}
Add custom metrics
This endpoint is used to add one or multiple custom metrics to your Customer Intelligence project.
curl -x POST 'https://api.talkwalker.com/api/v2/talkwalker/p/<project_id>/dataset_templates/t/<dataset_template_id>/custom_metrics/add?access_token=<access_token>'
Request
{
"custom_metrics": [
{
"name": string,
"title": string,
"description": string,
"display_in_ui": boolean,
"format": "DATE_TIME" | "DECIMAL" | "DURATION" | "INTEGER" | "TEXT" | "KEYWORD" // case-insensitive
},
...
]
}
Response
{
"result_custom_metrics": {
"dataset_template_id": string,
"data": [
{
"success": boolean,
"error_message": string, // if "success" # false
"custom_metric": { // if "success" # true
"name": string,
"title": string,
"description": string,
"display_in_ui": boolean,
"update_ts": number,
"format": {
"name": "DATE_TIME" | "DECIMAL" | "DURATION" | "INTEGER" | "TEXT" | "KEYWORD"
}
}
},
...
]
}
}
Delete custom metric
This endpoint is used to delete one single custom metric.
curl -X DELETE 'https://api.talkwalker.com/api/v2/talkwalker/p/<project_id>/dataset_templates/t/<dataset_template_id>/custom_metrics/m/<metric_name>?access_token=<access_token>'
Response
{
"result_custom_metrics": {
"dataset_template_id": string,
"data": [{
"success": boolean,
"error_message": string, // if "success" # false
"custom_metric": {
"name": string
}
}]
}
}
Delete custom metrics (bulk)
This endpoint is used to delete multiple custom metrics at once.
curl -X POST 'https://api.talkwalker.com/api/v2/talkwalker/p/<project_id>/dataset_templates/t/<dataset_template_id>/custom_metrics/delete?access_token=<access_token>'
Request
{
"metric_names": string[]
}
Response
{
"result_custom_metrics": {
"dataset_template_id": string,
"data": [
{
"success": boolean,
"error_message": string, // if "success" # false
"custom_metric": {
"name": string
}
},
...
]
}
}