Search code examples
javaspringrestapitwitter

Spring Social Twitter REST API and "until" date


I am trying to retrieve tweets for a hashtag using Spring Social Twitter APIs.

When I pass the date in required format in "until" field, I am not able to retrieve the tweets. I even tried directly invoking the REST API using https://dev.twitter.com/rest/tools/console (example https://api.twitter.com/1.1/search/tweets.json? q=<>&lang=en&count=10&until=2016-12-10).

However without the "until" date API works fine both through Spring and REST Tool.

Appreciate if anyone could help me understand this behavior.


Solution

  • The Twitter Search API only searches against tweets in the last 7 days (as mentioned in the documentation). Thus, if your until field is before 7 days from the query submission, no results will return.

    The only way to retrieve tweets posted longer than 7 days is to order a paid subscription to a Twitter service that has the ability to search against Twitter's historic data (i.e. Gnip, Nuvi, etc.). There are currently no free options that achieve this objective.