Closed anandvc closed 2 months ago
The following example code should work, as long as you substitute credentials from an app/project that is authorized to access the search API. For more details, see the search API documentation.
x_credentials = {
api_key: "INSERT YOUR X API KEY HERE",
api_key_secret: "INSERT YOUR X API KEY SECRET HERE",
access_token: "INSERT YOUR X ACCESS TOKEN HERE",
access_token_secret: "INSERT YOUR X ACCESS TOKEN SECRET HERE"
}
client = X::Client.new(**x_credentials)
query = "foo"
client.get("tweets/search/recent?query=#{query}")
If this code produces an error, please reply with it here so I can help you debug the issue.
@anandvc Is this example sufficient for your purposes?
Closing this issue. Please reopen if this code doesn't work for you.
I'd like to request an example in the README of how to call this endpoint with a basic query: https://api.twitter.com/2/tweets/search/recent