Hi,

I’m trying to get Tweets based on a geo point. And I’m using the Enterprise 30-day search. But I can not figure out how to format the URL string.

This is what I have:
https://api.twitter.com/1.1/tweets/search/30day/devblue.json?query=devblue%20%5C%22search%20api%5C%22%20%5C%22point_radius%20-122.271879%2037.805019%201mi%5C%22%&maxResults=30

The above is not working.

Can someone help me out?

Thanks.

I would use some existing code like GitHub - twitterdev/search-tweets-python: Python client for the Twitter 'search Tweets' and 'count Tweets' endpoints (v2/Labs/premium/enterprise). Now supports Twitter API v2 /recent and /all search endpoints. to make requests. This will take care of proper encoding and authentication etc.

Geo searches can be unreliable - also there may be another operators you might find more useful: Operators by product | Docs | Twitter Developer Platform

For point_radius though, the format is like this:

point_radius:[-105.27346517 40.01924738 10.0mi]

This would go into the query part, and the library will do the escaping and url encoding.

Thank you. I’m using C# in Unity. Do you know how to format the URL string correctly?

I’d let a library format the url string - but in general, i would instead send JSON encoded parameters with POST, instead of url encoded with GET Premium search APIs | Docs | Twitter Developer Platform

Thank you. I did find a library in C#.

The url string is this → 30day/+app name+.json?maxResults=100&query=point_radius%3A%5B-122.246566%2037.81759%201mi%5D

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.