Skip to main content

Custom Metrics in Talkwalker project

List custom metrics

This endpoint is used to retrieve the list of custom metrics created in your project.

curl -x GET 'https://api.talkwalker.com/api/v2/talkwalker/p/<project_id>/custom_metrics/list?access_token=<access_token>'
Response
{
"result_custom_metrics": {
"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 project. The custom metrics can also be created from the Talkwalker platform.

  • The custom metric name (custom_metric.name) corresponds to the "Field name" field in the Talkwalker platform. In the example above it's agency_name.
  • The title (custom_metric.title) corresponds to the "Metric name" field in the Talkwalker platform. In the example above it's Agency name.
curl -x POST 'https://api.talkwalker.com/api/v2/talkwalker/p/<project_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": {
"data": [
{
"success": boolean,
"error_message": string, // if "success" # false
"custom_metric": { // if "success" # true
"name": string,
"title": string,
"description": string,
"display_in_ui": boolean, // true or false
"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>/custom_metrics/m/<metric_name>?access_token=<access_token>'
Response
{
"result_custom_metrics": {
"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>/custom_metrics/delete?access_token=<access_token>'
Request
{
"metric_names": string[]
}
Response
{
"result_custom_metrics": {
"data": [
{
"success": boolean,
"error_message": string, // if "success" # false
"custom_metric": {
"name": string
}
}
]
}
}