How to search tweets using twitter REST search api?


#1

Hello everyone,

I have been trying to fetch tweets from twitter using twitter REST search api function.
I am struggling to do that.

I can see the sample output using the sample urls. But I am not able to fetch tweets using custom parameters?
What AUTH_HEADER should i need to provide ?

Proper documentation will be a great help.

Thanks for your help in advance.


#2

What parameters are you trying to use? What errors are you seeing? What API library are you using to call the search endpoint?

If you can provide more information we may be able to help, there is documentation available here.


#3

Thanks for the reply.
I am trying to query the search api from android app using retrofit.

The code is below:

public static final String API_URL = "https://api.twitter.com/1.1";    
public static final String AUTH_HEADER = "****************************"; // HERE WHAT SHOULD BE THE AUTH_HEADER?

    @GET("/search/tweets.json")
    void searchTweets(
            @Query("q") String query,
            Callback<SearchResults> callback
    );

This function can take any custom parameters…

Again many thanks for your reply.


#4

The auth header would need to correspond with the OAuth mechanism (app-only or user) that you are using for your app.


#5

Ok. thanks. I will give it a try.