v2 API cURL examples

The easiest way to get started with using the TrustServista API is to use cURL.

First

You will need a TrustServista API key. You can request one here. You will then be provided with a API key and the API documentation.

Second

Verify if you your API key is working by checking the TrustServista API status:

curl -X GET \

-H "X-TRUS-API-Key: your_api_key" \

-H "Content-Type: application/json" \

-H "Accept: application/json" \

-H "Cache-Control: no-cache" \

"https://trust.servista.eu/api/rest/v2/info"

Third

Test all of TrustServista API endpoint using the cURL examples below. All the endpoint parameters and sample JSON responses can be found in the API documentation reference.

metadata

curl -X POST \

    -H "X-TRUS-API-Key: your_api_key" \

    -H "Content-Type: application/json" \

    -H "Accept: application/json" \

    -H "Cache-Control: no-cache" \

    -d '{"contentUri": "http://www.foxnews.com/opinion/2017/03/01/president-trumps-best-speech.html" }' \

    "https://trust.servista.eu/api/rest/v2/metadata"

p0

curl -X POST \

    -H "X-TRUS-API-Key: your_api_key" \

    -H "Content-Type: application/json" \

    -H "Accept: application/json" \

    -H "Cache-Control: no-cache" \

    -d '{"contentUri": "http://www.nydailynews.com/news/world/trump-labels-north-korea-problem-menace-summit-article-1.3311227" }' \

    "https://trust.servista.eu/api/rest/v2/p0"

trustlevel

curl -X POST \

    -H "X-TRUS-API-Key: your_api_key" \

    -H "Content-Type: application/json" \

    -H "Accept: application/json" \

    -H "Cache-Control: no-cache" \

    -d '{"contentUri": "http://www.foxnews.com/opinion/2017/03/01/president-trumps-best-speech.html" }' \

    "https://trust.servista.eu/api/rest/v2/trustlevel"

summary

curl -X POST \

    -H "X-TRUS-API-Key: your_api_key" \

    -H "Content-Type: application/json" \

    -H "Accept: application/json" \

    -H "Cache-Control: no-cache" \

    -d '{"contentUri": "http://www.foxnews.com/opinion/2017/03/01/president-trumps-best-speech.html", "size": "20" }' \

    "https://trust.servista.eu/api/rest/v2/summary"

entities

curl -X POST \

    -H "X-TRUS-API-Key: your_api_key" \

    -H "Content-Type: application/json" \

    -H "Accept: application/json" \

    -H "Cache-Control: no-cache" \

    -d '{"contentUri": "http://www.foxnews.com/opinion/2017/03/01/president-trumps-best-speech.html" }' \

    "https://trust.servista.eu/api/rest/v2/entities"

sentiment

curl -X POST \

    -H "X-TRUS-API-Key: your_api_key" \

    -H "Content-Type: application/json" \

    -H "Accept: application/json" \

    -H "Cache-Control: no-cache" \

    -d '{"contentUri": "http://www.foxnews.com/opinion/2017/03/01/president-trumps-best-speech.html" }' \

    "https://trust.servista.eu/api/rest/v2/sentiment"

text

curl -X POST \

    -H "X-TRUS-API-Key: your_api_key" \

    -H "Content-Type: application/json" \

    -H "Accept: application/json" \

    -H "Cache-Control: no-cache" \

    -d '{"contentUri": "http://www.scotsman.com/news/uk/bbc-apologises-for-mystery-person-quiz-where-answer-was-ian-brady-1-4453616" }' \

    "https://trust.servista.eu/api/rest/v2/text" 

graph

curl -X POST \

    -H "X-TRUS-API-Key: your_api_key" \

    -H "Content-Type: application/json" \

    -H "Accept: application/json" \

    -H "Cache-Control: no-cache" \

    -d '{"contentUri": "http://www.nydailynews.com/news/politics/putin-election-meddling-denials-satisfied-trump-article-1.3311344" }' \

    "https://trust.servista.eu/api/rest/v2/graph"

similar

curl -X POST -H "X-TRUS-API-Key: your_api_key" \

-H "Content-Type: application/json" \

-H "Accept: application/json"  \

-H "Cache-Control: no-cache" \

-d '{"contentUri1": "http://derstandard.at/2000062446163/Nordkorea-empoert-ueber-US-Bomberfluege", "contentUri2": "https://www.welt.de/politik/ausland/article8613356/Nordkorea-droht-wegen-US-Manoever-mit-Atomwaffen.html" }' \

"https://trust.servista.eu/api/rest/v2/similar"

related

curl -X POST -H "X-TRUS-API-Key: your_api_key" \

-H "Content-Type: application/json" \

-H "Accept: application/json"  \

-H "Cache-Control: no-cache" \

-d '{"contentUri": "https://www.usatoday.com/story/news/world/2017/08/22/trump-afghanistan-strategy/588836001/", "interval": "0" }' \

"https://trust.servista.eu/api/rest/v2/related"

search

curl -X POST -H "X-TRUS-API-Key: your_api_key" \

-H "Content-Type: application/json" \

-H "Accept: application/json"  \

-H "Cache-Control: no-cache" \

-d '{"q": "trump AND afghanistan", "size": "50", "page": "1"}' \

"https://trust.servista.eu/rest/v2/search"