How can I prevent foreign objects appearing in a FB Places graph call? - facebook

I am confounded to find objects without any real link in my facebook graph calls. Say I make a call of places near a point in Denmark Europe. Along the list of results, I can risk to get items from singapore, korea, Austin TX and other completely off positions. But according to the FB result, the coordinates are matching.
Take this call for example :
FBGraph call, Center : 55.676127,12.581892 (Copenhagen, Denmark) , Distance : 1000m
Here are some expected results:
{
"name": "Fortunen Bar & Spiseri",
"location": {
"street": "Ved Stranden 18",
"city": "K\u00f8benhavn",
"country": "Denmark",
"zip": "1061",
"latitude": 55.677747326448,
"longitude": 12.5802503332
},
"category": "Local business",
"id": "454633487897742"
},
And suddently, a result that confuses me to the core :
{
"name": "CampusFrance Hong Kong",
"location": {
"street": "25/F, Tower II, Admirality Centre,18, Harcourt Road, Central, ",
"city": "Hong Kong",
"country": "Hong Kong",
"latitude": 55.67758,
"longitude": 12.58226
},
"category": "Government organization",
"id": "206130582769483"
},
I know i could filter them out with some name comparison on the Location country, but when people are close to borders, it would mess up my result, and also, if I request 20 items, i would risk ending up with 19 or 18, but still have a possible next page...
Anyone know of a flag or something one can set to avoid this ?

As Donn Lee mentions, this was a individual glitch. We are not sure why Facebook believes this entry is in Denmark, but its clear that it does not belong there.

Related

Algolia Places API: How to get the street of a place?

We are evaluation algolia places API and want to use it to find the address of sights. As an example, we want to find "Reichstagsgebäude, Berlin" which works and we get the correct response:
{
"query": "Reichstag, Berlin",
"suggestion": {
"name": "Reichstagsgebäude",
"administrative": "Berlin",
"city": "Berlin",
"country": "Deutschland",
"countryCode": "de",
"type": "address",
"latlng": {
"lat": 52.5186,
"lng": 13.3761
},
"postcode": "10557",
"highlight": {
"name": "Reichstagsgebäude",
"city": "<em>Berlin</em>",
"administrative": "<em>Berlin</em>",
"country": "Deutschland"
},
"value": "Reichstagsgebäude, Berlin, Berlin, Deutschland"
}
}
But how to get the real address of the Building with the Street name and Street Number included, which should be "Platz der Republik 1"
Currently, Algolia Places has street-level precision. We currently only have data for house-level precision (i.e., street name and street number) for France. This is an area we are actively looking to improve, but the data is still in process.

Facebook Graph API : possible values for category and categories_list fields of a place [duplicate]

This question already has answers here:
Authoritative List of all Facebook Subcategories
(2 answers)
Closed 5 years ago.
Facebook has not provided with any list of possible values for these fields.
here They have stated some categories for searching but these are not the values that are returned, Instead following values are returned for every place. I'm okay with that but where do I get a list of possible values for fields category and categories_list.
Thank you very much.
{
"checkins": 78,
"name": "SODA SHOTS & CAFE",
"location": {
"city": "Sangli",
"country": "India",
"latitude": 16.85507,
"longitude": 74.59768,
"street": "SIDE GATE OF WILLINGDON COLLEGE,NEAR BANK OF MAHARASTRA ,JAYHIND COLONY ,VISHRAMBAGH",
"zip": "416416"
},
"category": "Coffee Shop",
"category_list": [
{
"id": "128673187201735",
"name": "Coffee Shop"
},
{
"id": "273819889375819",
"name": "Restaurant"
}
],
"id": "246105402415302"
}
After a few more searches I found an answer
Authoritative List of all Facebook Subcategories
I'm beginner here and don't know what do now about the thread, someone please mark this as duplicate or please take appropriate action.
Thanks, all.

Getting facebook place id from instagram place

I know from the documentation of the instagram API that instagram has facebook locations mapped so you can search and get the location detail from instagram via facebook place id i.e.
https://api.instagram.com/v1/locations/search?facebook_places_id=273471170716&access_token=[ACCESS-TOKEN]
As you can see I am retreiving the location detail via facebook place id.
But in my scenario, what I want is to get facebook place id using instagram id from the instagram location detail. Below is what I mean:
I have got the instagram location id and can get the detail of the place using the following:
https://api.instagram.com/v1/locations/2862169?access_token=[ACCESS-TOKEN]
But the above call only returns the location name and geographic co-ordinates. Whereas I want the Facebook place id of the location as well. Is there any way for me to get the facebook place id from the instagram as well?
I have checked their documentation on Location endpoints (https://instagram.com/developer/endpoints/locations/) and wasn't able to find any relevant information.
The reason why I want that is, I need to get the location detail such as category etc as well which instagram API doesn't provide, so I plan on using this retrieved facebook place id on facebook graph API to retrieve this additional location details.
I think you can only use the Facebook Graph API search for this. Therefore, you can use the output from the Instagram API for latitude, longitude and name to construct a Graph API call which returns you a list of matching Facebook Place Pages.
If the Instagram location id is 788029 for example, the API will return the following JSON:
{
"id": "788029",
"latitude": 48.858844300000001,
"longitude": 2.2943506,
"name": "Eiffel Tower, Paris"
}
So, if you take this result and use the data to construct a Facebook Graph API search url, it will result in something like this:
https://graph.facebook.com/search?q=Eiffel%20Tower,%20Paris&type=place&center=48.858844300000001,2.2943506&distance=100&limit=3&access_token={app_access_token}
You can choose the distance as well as the limit as you desire. If you set limit=1 you will only receive the place which Facebook deems to be the best match. Replace {app_access_token} with an actual App Access Token.
The Facebook response will be something like
{
"data": [
{
"category": "Local business",
"category_list": [
{
"id": "276651312419490",
"name": "Monument"
}
],
"location": {
"street": "",
"city": "Paris",
"state": "",
"country": "France",
"zip": "75007",
"latitude": 48.858385562198,
"longitude": 2.2944861654879,
"located_in": "141184112585566"
},
"name": "Level 2 Eiffel Tower, Paris",
"id": "380503552017025"
},
{
"category": "Local business",
"category_list": [
{
"id": "186825111351005",
"name": "Tourist Attraction"
}
],
"location": {
"street": "",
"city": "Paris",
"state": "",
"country": "France",
"zip": "",
"latitude": 48.858205346341,
"longitude": 2.2944900587791
},
"name": "Eiffel Tower Sommett, Paris, France",
"id": "1458706024363987"
},
{
"category": "Restaurant/cafe",
"category_list": [
{
"id": "168976549819329",
"name": "French Restaurant"
}
],
"location": {
"street": "",
"city": "Paris",
"state": "",
"country": "France",
"zip": "75007",
"latitude": 48.858532957713,
"longitude": 2.2941094631632,
"located_in": "141184112585566"
},
"name": "58 Tour Eiffel (officiel)",
"id": "148894855169991"
}
],
"paging": {
"next": "https://graph.facebook.com/v2.2/search?limit=3&type=place&q=Eiffel Tower, Paris&center=48.858844300000001,2.2943506&distance=100&offset=3&__after_id=enc_AdCYS3bVKOc29JFMrqlsouSZCvBxUTYZC7nHvqDHKAiBNrOs2ehUIaOsJ2wL9TxF9KOfgGmqEPOaLwotDM4pIUqyFf"
}
}
See
https://developers.facebook.com/docs/graph-api/using-graph-api/v2.2#search
https://instagram.com/developer/endpoints/locations/

How to tell whether a URL is a Facebook Page or Profile?

I use FQL to validate whether a user-submitted URL is a Facebook Page or Profile as seen here: Validate a Facebook page URL
This previously worked. When I'd send a URL like facebook.com/zuck or facebook.com/cocacola it would return a normalized_url with profile.php or /pages/. Now, it just returns the same URL: e.g. facebook.com/zuck.
Is this a Facebook API bug? Or is there another way to solve this problem?
Perhaps use the Facebook Graph API and look for properties that only a page would have. For example the Coca Cola API return (see below) returns likes which only a page would have, you could also look for a description, website, about and location but don't rely on just one. Conversely, a person will tend to have a first_name and last_name. Use these in unison to determine whether the username is a person or page.
http://graph.facebook.com/zuck
{
"id": "4",
"name": "Mark Zuckerberg",
"first_name": "Mark",
"last_name": "Zuckerberg",
"link": "https://www.facebook.com/zuck",
"username": "zuck",
"gender": "male",
"locale": "en_US"
}
http://graph.facebook.com/cocacola
{
"id": "40796308305",
"name": "Coca-Cola",
"picture": "http://profile.ak.fbcdn.net/hprofile-ak-snc4/174560_40796308305_2093137831_s.jpg",
"link": "https://www.facebook.com/coca-cola",
"likes": 41519873,
"cover": {
"cover_id": "10150682306963306",
"source": "http://a7.sphotos.ak.fbcdn.net/hphotos-ak-snc7/s720x720/416803_10150682306963306_40796308305_9337341_812683101_n.jpg",
"offset_y": 0
},
"category": "Food/beverages",
"is_published": true,
"website": "http://www.coca-cola.com",
"username": "coca-cola",
"founded": "1886",
"description": "Created in 1886 in Atlanta, Georgia, by Dr. John S. Pemberton, Coca-Cola was first offered as a fountain beverage at Jacob's Pharmacy by mixing Coca-Cola syrup with carbonated water. \n\nCoca-Cola was patented in 1887, registered as a trademark in 1893 and by 1895 it was being sold in every state and territory in the United States. In 1899, The Coca-Cola Company began franchised bottling operations in the United States. \n\nCoca-Cola might owe its origins to the United States, but its popularity has made it truly universal. Today, you can find Coca-Cola in virtually every part of the world.",
"about": "The Coca-Cola Facebook Page is a collection of your stories showing how people from around the world have helped make Coke into what it is today.",
"location": {
"latitude": 53.71282619,
"longitude": -1.51214516
},
"checkins": 92,
"talking_about_count": 383754
}
I'm facing the same problem and I've decided to watch the "is_published" or "likes" fields.

How to Set Venue for Event using Graph API

When I create events, I've tried adding venue details similar to what it looks like below, but the venue information seems to be ignored. (I'm posting it to /me/events)
The event otherwise gets created successfully. How can I set the venue during the creation process? Do I need to create it afterwards instead? Thanks
{
"owner": {
"name": "David R",
"id": "234234"
},
"name": "sdf",
"description": "tes",
"start_time": "2011-09-11T00:00:00",
"end_time": "2011-09-11T03:00:00",
"location": "sadf",
"venue": {
"street": "weber",
"city": "Waterloo",
"state": "Ontario",
"country": "Canada"
},
"privacy": "SECRET",
"updated_time": "2011-09-10T23:22:23+0000",
"type": "event"
}
get rid of '"venue"{}' and just use city state country etc..
{'name':"neverland",
'city':"los angeles",
'description':"ontherparty",
'location':"sames",
'start_time': "9-12-2011 12:45"
}