Given a Facebook app's page/id, how do I find how many "likes" that app has? - facebook

farmville/frontierville/etc
How do I figure out how many "likes" these apps have?
The graph API does not work with apps.

The graph api below will show all the information related to the app
https://graph.facebook.com/159616034235/
result:

Call
https://graph.facebook.com/APP_ID
Try this example call in Graph Explorer:
https://graph.facebook.com/farmville
which will return a JSON reponse with id, name, picture, link and then likes as 5th value.

You can get the number of likes from Graph API by querying by Application id or Application namespace.
https://graph.facebook.com/APP_ID_OR_NAMESPACE
You can also limit results to be only constructed from id of an application and likes by using fields argument in URL:
https://graph.facebook.com/APP_ID_OR_NAMESPACE?fields=likes
Beware that not every application have a namespace defined and because name of application is not unique, it's better to use id of application to retrieve details from Graph API

You are wrong. The graph API does not work with apps.
http://www.facebook.com/dominodraw/
takes me to 'page not found'. So, dominodraw is not a valid facebook username.
Try graph.facebook.com/<your_app_id> and it will get likes for your app.
p.s. Just in case you are confused.
farmville is not only the name of app, but also they have registered farmville as facebook username.
So, they can do https://graph.facebook.com/farmville along with graph.facebook/208633805894647
If you havent set username for your app, you can only call graph api by app_id.

Related

Finding recent Facebook friends

How to find my recently added Facebook friends using Facebook application via fql or graph API?
Try this in the graph API tool:
SELECT created_time, description
FROM stream
WHERE source_id = me() AND type = 8
LIMIT 100
Ok, as its 30 days it's going to be a little harder. You need to parse the users home page (http://graph.facebook.com/feed?access_token=xxx).
Once you have that you'll need to look for the story tag where the user add's a new friend. You can get the new friends details from that. The wall feed goes very far back just FYI so you'll need to handle the time as well.
I think you are trying to make an application like Facebook Mapper.
This application is a very useful application for those who want to retrieve the facebook friends.
You can use it for access to a facebook profile. There is a chrome extension for the same. This is named as [Facebook Mapper Chrome][1]
Hope this will help you

facebook api access a page's photo album

So really what i would like to do is access my page's photos albums to include them into my own website. So i can upload to facebook and have that viewable on my own site.
I using the php skd but fql would be better for this as i can easily get a JSON object back and i believe i wouldn't need to use the sdk as this is for user's informtaion not a pages details.
So does anybody have ideas on this?
url i'm trying to access the query:
https://api.facebook.com/method/fql.query?query=SELECT%20name%20FROM%20album%20Where%20aid=%27118818791532414%27&format=JSON
Page i am taking the photos from:
www.facebook.com/mayfieldathleticfc
Album i am using as an example:
http://www.facebook.com/media/set/?set=a.118818791532414.24873.118816378199322
I thought maybe i hadn't set the photos to public but after closer inspection i don't believe you can do this?
Anyway thoughts are welcome =)
That URL returns to you an informative error message:
{"error_code":102,"error_msg":"Session key invalid or no longer valid",
"request_args":[{"key":"method","value":"fql.query"},
{"key":"query","value":"SELECT name FROM album Where aid='118818791532414'"},
{"key":"format","value":"JSON"}]}
To call Facebook APIs, you have to pass in a session key - even to access 'public' things. A good starting point for learning how to authenticate and get a session key is http://developers.facebook.com/docs/authentication/
After a little more routing around i realised that it was my id's and owners details that was not correct: api.facebook.com/method/… i had this sorted it worked.

Get facebook insight of facebook page using graph api

I am already getting insight's data for facebook application by using appid and secret key to get access token now i want get insight data for my facebook page , I don't know what I use in the place of secret key to access token.
I send request by this url to get app insights data https://graph.facebook.com/"+appId+"/insights?access_token="+token
now i need to know what i use intead of appId and how find access token of facebook page.
Insert pageid instead of appid, in this way you will be able to get facebook page insights
https://graph.facebook.com/"+pageId+"/insights?access_token="+token
Take a look at here. You will be able to list all pages for account and pull stats for a page_id.
https://github.com/facebook/insights-api-sample
The Facebook graph API has changed the URL pattern for the page insights, In the latest version they required at least on matrix otherwise they will throw the error like below
"error_user_msg": "No metric was specified to be fetched. Please specify one or more metrics to be fetched and try again.",
The new format is like below
/{post-id}/insights/{metric} (Posts on a Page only)*
Please refer the below link for more information
https://developers.facebook.com/docs/graph-api/reference/v3.0/insights

Facebook gives diffrent like count for same url in php sdk and graph api

I am using php sdk fql and graph api both for counting facebook likes. When I pass url like http://mydemowebsite.com/city/id-12345.html it gives me correct count but when I pass url like
http://m.mydemowebsite.com/city/id-12345.html to both the apis, its giving me different like count, Although it is the same page. It also shows same count on browser for both the links.
Like Counts unique identifier is the URL, you maybe able to get around this but going to Facebook App Edit Settings and under website set the site domain to mydemowebsite.com. this allows for any subdomains of mydemowebsite.com to use the facebook api.

Facebook graph API: feeds missing in json response

I try to fetch user's feeds via graph api from my Android application. It generally works but some feeds that I can see on the wall are missing in the json response.
I call the url http://graph.facebook.com/someUserId/feed, by using the Android Facebook SDK methods, so the access token should be provided automatically, but it's not really relevant I think in my case. Nevertheless fyi, the user of my app is authenticated via OAuth.
I already checked the following:
all the user's feeds are visible to everyone / public (set in privacy settings)
the json response is not cached by my browser
I am aware of paging, but this is not an issue. The problem is not that I am not getting the very oldest feeds but that some feeds are just missing in between.
I registered a new facebook user which is not connected to the user I want to retrieve the wall feeds from, and when I open the respective wall I see all the feeds there, as expected, since they're all public to everyone. Yet, when I open the same related json url unter http://graph.facebook.com/someUserId/feed, some feeds are missing.
This is an example of the problem - since all my posts are public, I can just call the json url directly in a browser to do a test.
I want to get wall feeds from user:
http://www.facebook.com/mathias.lin
Screenshot1: note the 3 marked postings, all posted by myself
and here the json response, as you can see, the 1st and 3rd wall posts are included in the json, but the 2nd post is not. Why?
The related json url is:
http://graph.facebook.com/mathias.lin/feed
I am getting the 'missing' feed when I add an access_token to the url - but why? The posted feed has a privacy setting for 'everyone'?!
This is the missing feed that I get when using the access_token:
{"id":"504063796_485195138796","from":{"name":"Mathias Lin","id":"504063796"},"message":"Photo test upload from Android","picture":"http:\/\/photos-e.ak.fbcdn.net\/hphotos-ak-snc6\/hs021.snc6\/165194_485195123796_504063796_6062399_1841907_s.jpg","link":"http:\/\/www.facebook.com\/photo.php?fbid=485195123796&set=a.485195118796.256450.504063796","name":"Torres Photos","icon":"http:\/\/static.ak.fbcdn.net\/rsrc.php\/yz\/r\/StEh3RhPvjk.gif","actions":[{"name":"Comment","link":"http:\/\/www.facebook.com\/504063796\/posts\/485195138796"},{"name":"Like","link":"http:\/\/www.facebook.com\/504063796\/posts\/485195138796"}],"privacy":{"description":"Everyone","value":"EVERYONE"},"type":"photo","created_time":"2011-01-06T05:10:43+0000","updated_time":"2011-01-06T09:00:23+0000","likes":6,"comments":{"data":[{"id":"504063796_485195138796_3607414","from":{"name":"Mathias Lin","id":"504063796"},"message":"Awesome, photo upload now works as well. Not so much fun working with the Facebook SDK for Android, would have expected more functionality beyond that just very very simple graph api wrapper. But need to be considered that the android sdk development was part of an internship - but since it's it's open source, it can luckily be modified. Which has to be done due to some bugs (mixing up the bundle parameters for a post, getString, getByteArray). Api documentation could be improved.","created_time":"2011-01-06T05:26:04+0000"},{"id":"504063796_485195138796_3608020","from":{"name":"Renate Hermanns","id":"628810487"},"message":"Wow
, how fast time passes by. Your daughter is nearly grown up ;-).","created_time":"2011-01-06T09:00:23+0000"}],"count":2},"attribution":"Torres"}
I've already posted the question to the FB dev forum, awaiting response.
Related threads:
http://forum.developers.facebook.net/viewtopic.php?id=81365
http://forum.developers.facebook.net/viewtopic.php?id=75984
Facebook Graph API "/userid/feed" returning Blank
Your approach is correct, I've seen the JSON and yes it's missing the second one, I think it's upload app form adroid, try checking the application settings for this app. Or If your trying to retrieve the wall FQL is a much better way
SELECT post_id, actor_id, target_id, message FROM stream WHERE source_id in (SELECT target_id FROM connection WHERE source_id=<uid> AND is_following=1) AND is_hidden = 0
I've been through this, the way Facebook is categorizing their permissions is somehow misleading, for example Publicly available may sounds like Available to everyone on Facebook but apperantly it's not.
Now in your case, if you already authenticated the user, then try using:
/me/feed
I guess this is the only case where access_token is not needed in the URL.
I had a similar problem. But for me, the problem was related to not setting the scope properly on first login (to authorize the app). I posted a similar question and got an answer that worked for me here:
Facebook API how to get all wall items