How to get place_id before checkin? - facebook

My app lets users checkin with lat, lon and place name to Facebook. But I don't know how to deal with "place" parameter.
Is there any way to get or create one?

Each checkinable place must have a valid Place Facebook Page.
The place parameter takes in the page_id of a Place Facebook Page.
For example, page_id 104999729569954 of Place Facebook Page http://www.facebook.com/pages/Nanyang-Polytechnic/104999729569954
If your application is letting your users to checkin based on their current location
1) Use an external map service such as Google Map's Geolocation to get the coordinates(lat & lon) of your user's current location.
The set of coordinates returned from Google Map is different from Facebook's own set of coordinates.
2) To overcome this, do a FQL query to find the closest match of Facebook's coordinates with Google Map's coordinates.
SELECT page_id,latitude,longitude FROM place WHERE distance(latitude, longitude, "LAT_HERE", "LON_HERE") < 250
250 refers to the radius(m) that it will search within, it can go up to 50000.
3) Now that you have page_id, latitude and longitude. Assign page_id into place parameter. Assign latitude and longitude into coordinates parameter. You will then be able to publish checkin.
You can refer to publish checkin examples that I have posted over here. Facebook - Publish Checkins using PHP SDK/JavaScript SDK
If your application is letting your users to checkin based on selection from a list of place names or gallery of images (in a game or something)
You will just need to find the page_id of each place and bind them to respective place name or image.
Documentation
Page FQL - http://developers.facebook.com/docs/reference/fql/page/
Checkins API - http://developers.facebook.com/docs/reference/api/user/#checkins

Maybe this is what you want.
Open graph explorer Just replace URL with any facebook page url
fql?q=SELECT id FROM object_url WHERE url="https://www.facebook.com/LegendCinema"

Related

Facebook Graph API: search people by city

I'm trying to find people either from particular city or who live in that city. Is there an API for this purpose?
When I use Facebook page, I can type in "People who live in Rome, Italy" (which is translated to URL https://www.facebook.com/search/115353315143936/residents/present) and it shows me all people who currently live in Rome. Using web page I can also search people by name and then add additional filter by city.
Can I do something similar with Graph API?
You can only search by name with the API: https://developers.facebook.com/docs/graph-api/using-graph-api#search - there is no way to get the same kind of search than on facebook.com.
you can add center and distance in the query
this comes from the documentation, you can change the type to type=user
GET graph.facebook.com
/search?
q=coffee&
type=place&
center=37.76,-122.427&
distance=1000

How can i get all users in a specific location in Facebook Graph API?

I am trying to get all Facebook users centered around 12.9667° N, 77.5667°E.
How can I do this?
I have tried the following query. But the Center and distance parameter don't seem to be working .
https://graph.facebook.com/search?q=mark&type=user&center=12.9667,77.5667&distance=1000
I still get Mark Zuckerberg in the results, even though he is no where close to the specified Lat-Long.
Where am I going wrong?
The center and distance field don't apply to the user object because the current_location field is not publicly available through the API. So, they are just ignored.
user_location or friends_location permissions to view:
current_location
Source: https://developers.facebook.com/docs/reference/fql/user/

Facebook search form a term with geolocation

Facebook has the Keyword Insights API that solves this question, but it's not available for all developers - except for some partners and we have this example:
SELECT location_results FROM keyword_insights WHERE term='Obama' AND country='US'
From https://developers.facebook.com/docs/keyword_insights/#examples
But without have access to Keyword Insights API is it possible search for user posts that have the term "Obama" in coordinates 39.781762,-89.649854 with a radius of 50 miles?
Thanks in advance.
No. It's not possible to get insights from the user posts without an access to the Keyword API.
An alternate can be to use the Facebook Graph API Search. It allows you to narrow your search to a specific location and distance. For example, you can specify the latitude and longitude using the center parameter in the query:
https://graph.facebook.com/search?q=obama&type=posts&center=37.76,-122.427
&distance=1000&access_token=<token>
You can parse the result obtained from it and generate insights on your own.

facebook fanpage geotaggig map

Is there a way to have a map on my facebook fanpage with geotaggs from my photos similar with instagram map ??
I have a lots of pictures and i”ve put on everyone location so it would be nice to find a way to display my route on a map.
10x
I'm not going to provide full code for you to do this, but if you are prepared to put a little bit of code together, this should be pretty simple:
Get a list of photos from your Page. You can do this via Graph API with either the /pageid/photos or /pageid/tagged/ connections. You will of course require an access token in order to request this information.
This will give you a list of Photo IDs, so you should now iterate through these IDs one by one (or using Batch Graph API requests) and request the Graph API object for each Photo ID. In each object will be a place field (if the location has been tagged, and if the user whose access token you are using is able to view the photo) which contains a Place ID.
For each of those Place IDs, there may be (some Places lack this) a location field which will contain a latitude and a longitude.
Use these Geo-points with an API for Google, Bing or some other mapping software to create an HTML page with a map filled with markers that highlight each of the photos.
Use this HTML page as your Page Tab URL for a Facebook app and then follow these instructions to add this as a tab to your Facebook Page.
Done.

Query Facebook to collect info on all birthdays in an area

First time poster so please be gentle. I'm looking for a way to run a FQL query that will return all of the birthdays for a given geographical area. For example: Return all of the (publicly-shared or access-token available) birthdays for everybody that lives within 50 miles of Portland, OR.
I've dinked around with FQL with simple queries, but once I hit the multi-query stuff it gets messier. Facebook's developer page gives an example of running the query in PHP, but I just want to figure out the proper URI variables and do it by hand in a browser window.
I assume you're asking about the current / app user's friends?
If so you're probably better to just pull all friends' birthdays, and current locations, and where the friend has a location specified, do your own matching - the API won't let you query users by current location