Twitter Sandbox doesn't return any result


#1

I’m using the ruby API to make tweet searches.

This API is primarily to standard search API, but I can override the method and change the url. Thats what’ve done.

module Twitter::REST::Search
    def search(query, options = {})
        options = options.dup
        options[:maxResults] ||= MAX_TWEETS_PER_REQUEST
        request = Twitter::REST::Request.new(self, :get, '/1.1/tweets/search/30day/dev.json', options.merge(query: query))
        Twitter::SearchResults.new(request)
    end
end

When I make the request I get none result.
But when I make the request to the standard endpoint ‘/1.1/search/tweets.json’ it does return.

Can anyone help me?


#2

The endpoint that you have in your code snippet will hit our premium Search API. You must have an approved developer account and set up your dev environment to make a request to this endpoint. Learn more here:
https://developer.twitter.com/en/docs/tweets/search/overview/premium


#3

Hello LeBraat,

Thank you for your reply.

I’ll clarify some points.
I already have an approved developer account.
I followed the ‘Get Started’ guide.
Firstly, I made some tests using the standard API, but I’ve got some inconsistencies with the search results, so I wondered if using the Search Tweets: 30-days Sandbox would give me an idea of the results of the premium API (to see if it fit to my needs. i.e, search results consistency), so I set a dev environment to my APP and used the endpoint to make the request.
When I go to the dashboard, I see the ‘tests’ requests I made to the sandbox endpoint, so I guess its working, but the question is why it’s returning nothing?


#4

That is likely due to your search query. Would you mind providing it here for us to investigate?

If it is just query: query, then you should try playing around with some other search queries.


#5

Well, I was investigating here and I discovered that the Ruby API was not parsing right the result, so when I asked for the list of results it was empty.

Now I’m able to get the results correctly. It was not a Twitter API problem.

Thanks again for your time and replies.


#6