How to search tweets using twitter REST search api?


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.


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.


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 = "";    
public static final String AUTH_HEADER = "****************************"; // HERE WHAT SHOULD BE THE AUTH_HEADER?

    void searchTweets(
            @Query("q") String query,
            Callback<SearchResults> callback

This function can take any custom parameters…

Again many thanks for your reply.


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


Ok. thanks. I will give it a try.