I'm trying to get a list of hospitals near GPS coordinates. According to this link
https://developer.foursquare.com/docs/resources/categories
The category ID for hospital is "4bf58dd8d48988d196941735"
I was reading the documentation and found this working example
https://api.foursquare.com/v2/venues/search?ll=29.253219,-81.732377&client_id=MYCLIENTID&client_secret=MYCLIENTSECRET&limit=1&v=20180628
Then I modified it to get the hospitals only
https://api.foursquare.com/v2/venues/4bf58dd8d48988d196941735?ll=29.253219,-81.732377&client_id=MYCLIENTID&client_secret=MYCLIENTSECRET&limit=1&v=20180628
But it returns the following result
{"meta":{"code":400,"errorType":"param_error","errorDetail":"Value 4bf58dd8d48988d196941735 is invalid for venue id","requestId":"5b5c04226a60714256a11fff"},"response":{}}
Any idea where my mistake is?
You need to use categoryId parameter.
e.g.
https://api.foursquare.com/v2/venues/search?ll=29.253219,-81.732377&categoryId=4bf58dd8d48988d196941735&client_id=MYCLIENTID&client_secret=MYCLIENTSECRET&limit=1&v=20180628
Related
I have been using foursquare api venues search with intent=match and it returned reasonable results a few months ago. Now, when I do the same search, results are empty.
E.g.
https://api.foursquare.com/v2/venues/search?ll=51.4914147,-0.1608899%20&client_id=clientId&client_secret=clientSecret&v=20131016&intent=match&query=The%20Five%20Fields
returns an empty venues array, despite of the version parameter being the same as before. It does not return an error, just the empty array (with valid clientId and clientSecret).
It still works with intent=checkin, but the match seems like an obvious choice for me. Any ideas why it doesn't work anymore?
intent=match is still working.
E.g.
https://api.foursquare.com/v2/venues/search?ll=51.4914147,-0.1608899&client_id=(YOUR_CLIENT_ID)&client_secret=(YOUR_CLIENT_SECRET)&v=20131016&intent=match&query=John%20Sandoe%20Books
I don't know why, but it does not work “John Sandoe Books” only..
I can limit by specifying "categoryId" parameter in the /search api, but what about /explore? The "query" parameter says it also searches categories but it's picking up tips too. Completely unrelated venues show up in the results just because someone mentions part of the category name in a tip.
I can just remove results that don't match the category but I'd like for there to be another way.
The reason I want to use /explore is so I can get the rating and price, as well as a sample photo.
You can use categoryId parameter with explore. It's undocumented.
With explore, the closest approximation to a categoryId filter will be using the section parameter. As per our search docs, explore and search serve different purposes, and the section param fits explore much better.
If you want to filter by categoryId yet still want photos and rating, I recommend calling venues/search then conducting a second venue details call to get that info.
I know for a fact that there are atleast 5-6 POI within the 50 mile radius in this area. However, I don't get any results on this query.
https://api.foursquare.com/v2/venues/suggestCompletion?ll=-44.67,167.92&query=milford&radius=50000
I see results when I try search api (it doesnt use query as mentioned in documentation):
https://api.foursquare.com/v2/venues/search?ll=-44.67,167.92&intent=checkin&query=milford&radius=50000
No results with intent match on the search query.
I really like the suggestcompletion api (compact). Any suggestion/input would be great?
Thanks!
The suggestcompletion endpoint is used to suggest venues whose names start with the provided query. The endpoint is used to provide autocomplete results for search input fields. It is not used as a general purpose venue search - you should use the /venues/search endpoint for this purpose.
looks like you have missed out the API version param. You need to denote it by adding this into your request :
&v=20150826
suggestCompletion is included into newer API released on 20150826 which differs from default one that not including suggestCompletion feature.
How to get list of users, who like certain media, but with offset and limit parameters?
And how to use pagination?
When i retrieve response GET /media/{media-id}/likes?access_token={access_token}&count=5, it always return 200 likes and pagination=<null>.
How to iterate through all comments and likes?
Offset is not available. But there is MAX_ID parameter, where you can specify the ID of the last item you got.
You can find further information about the endpoints here.
I had this same problem... Instagram API doesn't allow you to paginate or limit the amount of likes returned. I solved this by limiting my foreach statement and you can probably do the same thing with a for statement.
Not quite what you asked, but in case you just want to get like count, you can do:
GET /media/{media-id}
And check the --data-likes-count on the JSON response.
Some popular words, like "food," are used all over the world as loan words.
I am trying to use flickr.photos.search to get photos from one specific language or region.
I didn't find a setting for this in http://www.flickr.com/services/api/flickr.photos.search.html
I tried these two ways, but neither worked:
http://api.flickr.com/services/rest/?method=flickr.photos.search&api_key=XXXXXXXXXX&tags=food&format=json&location=japan
//lang=jp
I searched in Google and only found that YQL can search by location. (I will use YQL in another way, too many calls will over the api will be limited.)
I also found that in flickr.photos.search one can set a lat, lon, and radius, but the range is a circle, so this will not limit a search to a specific country.
None of these are good choices for me. Can anyone help?
There are actually a few interesting ways to do this.
The way I would do it is to first find the place you are looking for by using the place API:
flickr.places.find: http://www.flickr.com/services/api/flickr.places.find.html This will return a list of WOE (Where on Earth) ids for a given query. Your query can be anything from a street address to a country.
Once you have the WOE id, you could then submit a flickr.photos.search query including the optional place_id or WOE id.
Another fun way to do this would be to call the flickr.places.tagsForPlace method once you have a WOE id, and then search for your photos by these tags. This might produce more interesting results and also weed out the users who didnt specify a place, but did specify tags.