Skip to main content

How to update a query line in the topic

important

You cannot update only 1 query line. You should update the whole topic by importing multiple topic_lines items in the request body.

To update a query line, we need to set the field override to TRUE to remove the existing query lines and add the new ones. The topic ID and category ID must be provided.

In this sample, we want to change the sourcetype in the 2nd query line from Twitter to Tik Tok: topic_add_query_line_result.png

It’s the topic ID l2stbi2e_1555byu18z5b5 in the group default.

Command
curl -X POST 'https://api.talkwalker.com/api/v2/talkwalker/p/<project_id>/topics/import?access_token=<access_token>'
Request
{
"topic_type": "search",
"topic_line_import": [
{
"topic_id": "l2stbi2e_1555byu18z5b5",
"topic_title": "my new topic",
"category_id": "default",
"override": true,
"query": "cats AND dogs AND lang:en",
"included_query": true
},
{
"topic_id": "l2stbi2e_1555byu18z5b5",
"topic_title": "my new topic",
"category_id": "default",
"override": false,
"query": "sourcetype:Trendiction AND sourcetype:SOCIALMEDIA_TIKTOK",
"included_query": true
}
]
}
Important

If your request body contains multiple query lines, for the other items, we need to set the field override to FALSE, otherwise you will have only the last item as a result.

Result in Talkwalker: topic_update_query_line_result.png