Skip to main content

How to create a new topic

In the category “ungrouped”

To create a topic in the category “ungrouped”, we should use the category ID “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_title": "my new topic",
"topic_description": "This is a topic description",
"category_id": "default",
"override": false,
"query": "cats AND dogs AND lang:en",
"included_query": true
}
]
}

Result in Talkwalker:

topic_create_result.png

note
  • In this sample, we create a topic with an include query. To create a query line in the exclude topic section, set the parameter included_query to FALSE.
  • The object topic_line_import is an array, so you can create multiple topics within one call.

In an existing group

To create a topic in an existing group, we should provide the corresponding group ID in the field category ID.

In this sample, we will create the new topic in the group named “test group” (which has the ID ks4prmoa_1tucp7x975i76):

command
curl -X POST 'https://api.talkwalker.com/api/v2/talkwalker/p/<project_id>/topics/import?access_token=<access_token>'
Request
Request body:
{
"topic_type": "search",
"topic_line_import": [
{
"topic_title": "my new topic",
"topic_description": "This is a topic description",
"category_id": "ks4prmoa_1tucp7x975i76",
"override": false,
"query": "cats AND dogs AND lang:en",
"included_query": true
}
]
}

Result in Talkwalker:

topic_create_2_result.png

note
  • In this sample, we create a topic with an include query. To create a query line in the exclude topic section, set the parameter “included_query” to FALSE.
  • The object “topic_line_import” is an array, so you can create multiple topics within one call.

In a new group

To create a topic in a new group, We need to remove the field category_id from the request body and to add the field category_title.

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_title": "my new topic",
"topic_description": "This is a topic description",
"category_title": "my new group",
"override": true,
"query": "cats AND dogs AND lang:en",
"included_query": true
}
]
}

Result in Talkwalker:

images/topic_create_group_1_result.png

images/topic_create_group_2_result.png

note
  • In this sample, we create a topic with an include query. To create a query line in the exclude topic section, set the parameter “included_query” to FALSE.
  • The object “topic_line_import” is an array, so you can create multiple topics and groups within one call.