Showing posts with label Graph API. Show all posts
Showing posts with label Graph API. Show all posts

Tuesday, March 20, 2012

How to use the Graph API to search for places

Facebook has recently updated their documentation on their search* feature. This is exciting news! In this blog I want to show you how simple it is to search for places or locations in a geographical area. All you need to know is the center coordinates of the location to be searched.

* note: Facebook's made it hard to directly link to the information as they have no anchor tag in the long page. Scroll down to the "Search" heading.

To search for places near a geographical location


https://graph.facebook.com/search?q=coffee&type=place&center=37.76,-122.427&distance=1000&access_token=VALID_ACCESS_TOKEN

I believe the distance parameter is in meters, but it is hard to tell because they've left that part undocumented.

To search for objects near a geographical location


https://graph.facebook.com/search?type=location&center=37.76,-122.427&distance=1000&access_token=VALID_ACCESS_TOKEN

What's interesting is you will get check-ins from friends if you're using a user access token for this query. Here's what Facebook says:

In addition, the returned objects will be those in which you or your friend have been tagged, or those objects that were created by you or your friends. There are important behavioral differences in the results depending on the permissions your app has acquired. Please see the documentation for the location_post FQL table for more information.

Happy coding! And as always be nice to your API.


Facebook Graph API undocumented (or poorly documented) properties and connections.

I'm writing this post to shed some light on poorly documented Graph API properties and connections. All comments are welcome and I'll try to update this blog entry with the latest and greatest.


photo.backdated_time

Some information about backdated_time can be found in this stackoverflow question.


user.installed

Appears to be letting us know if the user has installed the current application. You can see this field added by specifically declaring on the Graph API call of `me/friends?fields=installed`. Yet another stackoverflow question led me to this information.


user.email

Can't seem to get the email on the user object? Well, just add `?fields=email` to your Graph API query and you now will get that information.