Search api only returning newest results despite max_id and since_id


#1

Hi all

I’m new to the Twitter API and to API’s in general.

I’m trying to use the search API to extract tweets from a single user using Power BI. If I run it for my account (https://api.twitter.com/1.1/search/tweets.json?q=from:bidgeir) I get 5 results which is to be expected as there are only those 5 for the last 7 days.
Example
id_str
871295127200960513
870376141420466180
870375416606986244
870373488116346882
869960308424495104

As I understand it I should be able to extract older tweets by using max_id and since_id. When I try to use max_id = 869960308424495104 (lowest id in the first list) I get only one tweet (https://api.twitter.com/1.1/search/tweets.json?q=from:bidgeir&max_id=869960308424495104). If I find on Twitter the tweet before id 869960308424495104 and put that into the query I get no results. All this is despite me seeing many more tweets on my account.

I have tried using since_id in combination with max_id and I have tried using count as well but I don’t seem to be able to get other tweets than those from the last 7 days no matter how few they are.

Can someone please advice me on what I’m doing wrong?

best regards,
Ásgeir


#2

There’s nothing wrong here - the search API will only ever return Tweets from the past 5-7 days, regardless of the id you pass in. You could use the timeline APIs to page through your own timeline for older Tweets (up to ~3200 in total).


#3

Thanks for the reply Andy

I completely misunderstood it. I will try the timeline API instead.

Best regards,
Ásgeir