Java – Use the soundcloud API to search by geofilter

Use the soundcloud API to search by geofilter… here is a solution to the problem.

Use the soundcloud API to search by geofilter

When trying to search for tracks based on the “geo” filter, I always get zero results. According to the documentation, you can use ***** as a wildcard to search for latitude/longitude ranges present in the “label list” for each track in the server response. We use the “Tags” filter when making POST requests.

For example

HttpResponse response = api.get("/tracks?tags=geo:lat%3D52.0*", null);

Returns zero results.

I’ve also tried omitting the “geo:” namespace reference, trying various latitude and longitude string variants such as ‘lat=52.0’ ‘geo:lat=52.0*’. Tried both urlencoded and non-urlencoded values and nothing seemed to work.

If I do

HttpResponse response = api.get("/tracks?tags=geo:", null);

This brings back the result that the geolocation is referenced in the tag list, so there must be a geotagged track in the database! I’ve copied one of the geo: positions from a random track into the POST parameter of the api request, but it doesn’t find the track.

As far as I know, another person submitted this issue on SO a month ago using JQuery Soundcloud api: Geo Tag search not working

Any help would be appreciated.

(FYI, the null parameter in the code I used above is just another option for passing the post parameter, you can choose to use the NameValuePair object, I also tried this way without success [when searching on a geofilter])


This should work

HttpResponse response = api.get("/tracks?geo:lat%3D52.0*", null);

Related Problems and Solutions