Foursquare API for mobile application - foursquare

Im new to foursquare api. I would like to know whether foursquare api will return the latitude and longitude of the user location(when GPS enabled), or should we use another method to get current user location.
Thanks in advance

You should get current user location reading GPS data from user device and use it when requesting Foursquare API endpoints. For an example, see https://developer.foursquare.com/docs/venues/search
As far as I know, a server API (such as Foursquare) has no means to get your current location except for Geo-IP services (not always accurate).

I have found that when using venue/search, etc. to find information, the response back to the api web call is filled with all sorts of information, including a "field" called location, that on android systems had to cast to JSONobject then you can get the lat and long of that place and distance from you if used with radius. Like above, use your gps and the development language to get that information.

Related

Stored Value Sets that are accessed throughout a Bixby Voice Experience

I am completely new to Bixby development so I apologize in advance if this is a newby question that doesn't make sense. I'm trying to understand the best way to store value sets returned from external APIs to use throughout Bixby Voice experiences. An example might be an API that gets all the menu items at a restaurant or an API that gets all the clothing catalog items from a store. When users interact with the data to search or transact I don't want to have to go back to the external API to get the value set again. For example: Find Vegan Menu options followed by Okay how about pescatarian options. Or: Find dress pants followed by okay how about dress shirts. I'd like to come back to a menu object in the first case or a catalog object in the second without having to re-load the value sets from the API.
In the sample code I've seen all of the value sets appear to be read in each time an action/endpoint/java call is made
There is no local storage in the current version of Bixby.
The easiest solution is to request through API calls. However, http.getUrl() itself is cached by default, and Bixby runs on Samsung server, so no actual API calls in practice when requesting same url in short sessions.
You can read more about http API options and how to disable cache feature by reading more here

How to grab instagram users based on a hashtag?

is there a way to grab instagram users based on a specific hashtag ?
I run contests based on re posting photos with specified hashtag then randomly pick a winner, i need a tool that can grab the usernames of those who reposted that photo and used that hashtag.
You can query instagram using the API. There are official clients for both python and ruby.
You didn't specify what language/platform you are using, so I'll give you the generic approach.
Query instagram using the Tag Recent Media endpoint.
In the response, you will receive a user object that has the user's username, id, profile url, and so on. This should be enough to do what you are describing.
As far as tools, there aren't great options to probably do things exactly how you want. If you just want a simple contest, you could use statigram, but it's not free.
If you roll your own solution, I highly recommend you also do the following:
Implement a rate limiting mechanism such as a task queue so you don't exceed your API calls (5000 per hour for most calls). Also useful for failures/network hicups, etc.
Have users authenticate so you can use OAuth to extend your API calls to 5000/per user/hour to get around #1.
Try the subscribe API if there won't be many items. You can subscribe to a specific tag as well, and you will get a change notification. At that point though you need to retrieve the actual media item(s), and this can cost a lot of API calls depending on how frequent and what volume these changes occur.
If your users don't have much photos/relatively small/known in advance, you can actually query the user's recent media instead and filter in your own code by hash tag.

foursquare api who's been there

I which to display on my website a the list of maybe the last 5 peoples who checked in my venue.
I didn't find any method in the api to do that, the closest was showing your friend...
I tell my boss that it wasn't possible to do that then he shows me this site :
http://www.brooklynmuseum.org/community/foursquare/
How is it possible to get this kind of list and if possible with no authentication (my server will do the call no a real person so no oauth...)
thanks !
You can use the Venue Push API (documented here) to notify your website whenever a user checks in to your managed venue, which you can use to update such a list.

Why will Foursquare hereNow endpoint not return items?

My application uses hereNow api. I checked-in CORRECTLY (i.e. physically present in the location) to a venue and then var_dump the request response from calling the hereNow endpoint, so it returns "count" but "items" is empty as shown below.
string '{"meta":{"code":200},"notifications":[{"type":"notificationTray","item":{"unreadCount":1}}],"response":{"hereNow":{"count":1,"items":[]}}}' (length=138)
I attempted the same thing using foursquare explorer but obtained similar result. Could you kindly explain why this could be so and what is the idea behind "unreadcount". Thank you.
a) Make sure that the OAuth token you are using to make the hereNow request is for the same user who checked in. You must be acting on behalf of a user who has checked in to a venue to see who is "here now"
b) It's possible that your check-in is being recognized as a cheat because you have checked in too frequently recently, or the lat/long coordinates provided by your device were not accurate enough.

Foursquare Checkin in delivery restaurants

I have an app where you can buy food on delivery restaurants.
Can I use the Foursquare API so the user can check-in on the restaurant that he order from?
Probably the user will not be in the resutaurant it self when he checkin.
There is an special way to do this on the foursquare api?
thanks
You can check-in any user that has authorized your application at a venue using the /checkins/add endpoint in the API. If you don't know the user's actual location (or fully expect them not to actually be there, but have a legitimate reason to be checking in, e.g. for delivery) be sure to leave the lat/lng parameter blank. The check-in will go through and be in the user's history, but won't count for badges/mayorships, etc.
I'm not too sure what you're asking. I don't think you can check in to places if you're not even near them (or at least I wasn't able to when I last used the 4sq API).
Check this tutorial out if you need help getting started with the API, or read the 4sq api documentation.

Resources