Use cases
How to upload a new document via API
Mandatory fields to upload a document
4 fields are mandatory when creating a document:
- URL: used to identify the document. Must be unique. The URL must match to one of the channels (domain or host, see previous section).
- Title
- Content
- Published date (epoch time in milliseconds).
The other required fields will be automatically filled or deduced.
Simple document upload
API Call example
curl -X POST 'https://api.talkwalker.com/api/v2/docs/p/<project_id>/create?access_token=<access_token>' \
-d '{
"url": "https://www.bbvaopenmind.com/en/articles/internet-changed-everyday-life/",
"title": "How the Internet Has Changed Everyday Life",
"content": "This is example of content",
"published": "1625398761000",
"extra_author_attributes": {
"name": "Zaryn Dentzel",
"gender": "MALE"
}
}'
Result in Talkwalker platform:
tip
note
The column writable
indicates which field can be imported/modified with the API.
How to add metrics on a document
We can add metrics to the document (sentiment, engagement, reach, etc). Here is a sample where the engagement metric is added to an existing document:
curl -X POST 'https://api.talkwalker.com/api/v2/docs/p/<project_id>/update?access_token=<access_token>' \
-d '
{
"url": "https://www.bbvaopenmind.com/en/articles/internet-changed-everyday-life/",
"title": "How the Internet Has Changed Everyday Life",
"content": "This is example of content",
"published": "1625398761000",
"extra_author_attributes": {
"name": "Zaryn Dentzel",
"gender": "MALE"
},
"engagement": "12"
}'
Result in Talkwalker platform:
How to create a thread view
Use the field parent_url
to link a new document to an existing one.
curl -X POST 'https://api.talkwalker.com/api/v2/docs/p/<project_id>/create?access_token=<access_token>' \
-d '
{
"url": "https://www.bbvaopenmind.com/en/articles/the-impact-of-the-internet-on-society-a-global-perspective/",
"title": " The Impact of the Internet on Society: A Global Perspective",
"content": " The Internet is the decisive technology of the Information Age",
"published": "1625485161000",
"extra_author_attributes": {
"name": " Manuel Castells",
"gender": "MALE"
},
"engagement": "10",
"parent_url": "https://www.bbvaopenmind.com/en/articles/internet-changed-everyday-life/"
}'
Result in Talkwalker platform:
How to upload multiple documents in one call
Advanced API supports batch mode to upload/modify multiple documents in one call.
curl -X POST 'https://api.talkwalker.com/api/v2/docs/p/<project_id>?access_token=<access_token>' \
-d '[
{
"update": {
"url": "https://www.bbvaopenmind.com/en/articles/the-impact-of-the-internet-on-society-a-global-perspective/",
"title": "The Impact of the Internet on Society: A Global Perspective",
"content": "The Internet is the decisive technology of the Information Age"
}
},
{
"create": {
"url": "https://www.bbvaopenmind.com/en/articles/internet-changed-everyday-life/",
"title": "How the Internet Has Changed Everyday Life",
"content": "This is example of content",
"published": "1625398761000",
"extra_author_attributes": {
"name": "Zaryn Dentzel",
"gender": "MALE"
}
}
}
]'
note
With the update operation, only modified fields are required.