I need to routinely call Bing News Search results via its API, checking for fresh stories matching a given search query.
I only want to return stories newly published since the last time I called the API.
For example, an hourly call to the API should constrain the search for stories from between the last hour and now (ie. stories published within the last hour).
Here is documentation for Bing News Search API - https://learn.microsoft.com/en-us/rest/api/cognitiveservices/bing-news-api-v7-reference
It makes clear a parameter, "since", which takes Unix epoch time. I will always be able to programmatically generate the epoch time for the start of the period.
Documentation states:
The Unix epoch time (Unix timestamp) that Bing uses to select the trending topics. Bing returns trending topics that it discovered on or after the specified date and time, not the date the topic was published.
If I want to return stories starting from June 22, epoch time for human GMT time Friday, June 22, 2018 12:39:51 PM is 1529671191.
This should allow me to generate API query URL https://api.cognitive.microsoft.com/bing/v7.0/news/search?q=%22Cardiff%22&since=1529671191000&count=100&sortBy=Date&textDecorations=true&textFormat=HTML
- q="Cardiff"
- since=1529671191000
- count=100 (maximum)
- sortBy=Date
- textDecorations=true
- textFormat=HTML
However, when that call is performed, the longest-ago "datePublished" field for a returned story object is "2018-06-20T23:18:00.0000000Z" (ie. June 20), which is clearly two days before the "since" parameter that I specified.
It's so curious, and frustrating. The alternative constraint parameter "freshness", when specified as "Day", seems to successfully constrain the search period to the last 24 hours. But that is not granular enough. "Since" does not work and does not do anything at all.
Is "since" only intended to be used to return Bing News' "Trending Topics" story lists, and not results of news search queries? The documentation language may be ambiguous.
If this is the case, how can I constrain the start/"since" date for my search through the API, other than with "freshness"?