Filter GET/v1/search by language or region

answered

#1

For the GET/v1/search endpoint, can we filter according to language or region? I’d like to have the highest velocity sorting that comes with the GET endpoint. Alternatively, can we get highest velocity values from the POST/v1/articles endpoint somehow?


#2

The GET v1/search endpoint doesn’t offer that functionality, but you can with POST v1/articles. Just set the language or region_code in the filters array, and set the sort_by to use nw_max_score.

For example:

curl -H "Content-Type: application/json" -X POST -d '{
    "filters": ["language:en AND headline:rihanna"],
    "sort_by": "nw_max_score"
}' "https://api.newswhip.com/v1/articles?key=YOUR_KEY_HERE"