How to tell if ID is a Facebook App or User
I have a page that is using Open Graph and FBML to put a Like and Send button on my page. The client has provided me with two "User IDs" per my request; however, when I submit them in the fb:admins meta tag and use it against the Facebook debug, I get the following error Too many app ids specified
, despite not providing a fb:app_id meta tag.
My question is simple, how do开发者_运维知识库 I determine whether an ID provided is a user ID or an app ID?
another way is to query the obj ID with a param metadata=1,
e.g. query 123213121232131229?metadata=1&fields=id
in the returned metadata, check for the value in "type" field
Try adding them to the Facebook graph URL and check the results: https://graph.facebook.com/?ids=XXXXXXX,YYYYYYYY
where XXXXXXX
and YYYYYYYY
are the IDs, example:
https://graph.facebook.com/?ids=579187142,40796308305
Querying my ID and Coca-Cola's page id would return:
{
"579187142": {
"id": "579187142",
"name": "Ibrahim Faour",
"first_name": "Ibrahim",
"last_name": "Faour",
"username": "ifaour",
"gender": "male",
"locale": "en_US"
},
"40796308305": {
"id": "40796308305",
"name": "Coca-Cola",
"picture": "http://profile.ak.fbcdn.net/hprofile-ak-snc4/203509_40796308305_256509_s.jpg",
"link": "http://www.facebook.com/coca-cola",
"likes": 33623022,
"category": "Food/beverages",
"website": "http://www.coca-cola.com",
"username": "coca-cola",
"founded": "1886",
"products": "Coca-Cola is the most popular and biggest-selling soft drink in history, as well as the best-known product in the world.\n\nCreated in Atlanta, Georgia, by Dr. John S. Pemberton, Coca-Cola was first offered as a fountain beverage by mixing Coca-Cola syrup with carbonated water. Coca-Cola was introduced in 1886, 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.",
"parking": {
"street": 0,
"lot": 0,
"valet": 0
},
"hours": {
"mon_1_open": 0,
"mon_1_close": 0,
"tue_1_open": 0,
"tue_1_close": 0,
"wed_1_open": 0,
"wed_1_close": 0,
"thu_1_open": 0,
"thu_1_close": 0,
"fri_1_open": 0,
"fri_1_close": 0,
"sat_1_open": 0,
"sat_1_close": 0,
"sun_1_open": 0,
"sun_1_close": 0,
"mon_2_open": 0,
"mon_2_close": 0,
"tue_2_open": 0,
"tue_2_close": 0,
"wed_2_open": 0,
"wed_2_close": 0,
"thu_2_open": 0,
"thu_2_close": 0,
"fri_2_open": 0,
"fri_2_close": 0,
"sat_2_open": 0,
"sat_2_close": 0,
"sun_2_open": 0,
"sun_2_close": 0
},
"payment_options": {
"cash_only": 0,
"visa": 0,
"amex": 0,
"mastercard": 0,
"discover": 0
},
"restaurant_services": {
"reserve": 0,
"walkins": 0,
"groups": 0,
"kids": 0,
"takeout": 0,
"delivery": 0,
"catering": 0,
"waiter": 0,
"outdoor": 0
},
"restaurant_specialties": {
"breakfast": 0,
"lunch": 0,
"dinner": 0,
"coffee": 0,
"drinks": 0
}
}
}
And query a single id:
https://graph.facebook.com/?id=291549705119
Which is CityVille App:
{
"id": "291549705119",
"name": "CityVille",
"description": "Grab your hard hats and work boots, 'cause it's time to get building! Welcome to CityVille, where you and your friends can build the city of your dreams! Play now at: http://zyn.ga/1qJ",
"category": "Games",
"subcategory": "Other",
"link": "http://www.facebook.com/apps/application.php?id=291549705119"
}
精彩评论