Get the profile picture with the Facebook C# SDK - facebook

I would like to get the profile picture. Can I do that with the Facebook SDK, and how?
When I use the Api.get option I get a jsonreader exception.

You can render the photo by just doing:
<img src="https://graph.facebook.com/**id**/picture"/>
in your page (obviously changing the id to the id of the user).
You don't have to retrieve it using the API, but you do have to retrieve the id.
You can also get pictures by their id using /photoid like so /98423808305
You can find more information here - http://developers.facebook.com/docs/graph-api

Related

Facebook API - get public images

I am new to use Facebook API in an android app. I m trying to access all public images from facebook using facebook API where user can get all pictures with given location from facebook.
How is it possible?
What you want to achieve is not possible, there is only another possibility, a workaround:
Get Facebook Places by location - it seems to work even without specifying the "q" parameter for a name: https://developers.facebook.com/docs/graph-api/using-graph-api#search
Get photos for those Facebook Places: /place-id/photos
More information: https://developers.facebook.com/docs/graph-api/reference/

How to get the facebook photo from fbid using FQL?

It is weird sick in this situation. I know the answer but it does not work.
I use php to write a photo upload system. The picture will upload to facebook from my server and it return me the fbid. So I can use this fbid to run a FQL to get the photo's different size. The FQL is:
SELECT src_small, src_big, images FROM photo WHERE object_id=[fbid]
This work good in my php system. It return an array that contain different picture size of url. I save them in database including the fbid. Sometime it get NoPic words, so I decide to check this photo array from facebook. I run the FQL in my system again and also try the facebook graph API tools. Both of them return empty array set.
Then I use the facebook link to check if the object exist, it work.
https://www.facebook.com/photo.php?fbid=220817144722724
This means the object exist, but I cannot get it from FQL anymore...
How can I get it again?
If you successfully uploaded your photo, it means that you undoubtedly set the photo_upload permission. Unfortunately, this permission only allows you to POST photos, but not to GET them.
Therefore, I suppose you forgot to set the user_photos permission. Or perhaps didn't you set it at the right place or wasn't it re-used by your FQL query?
That must be it, because I tried it and everything is OK on Facebook's side.

How to get the facebook user id that likes my website (not a facebook site)

I am making a raffle within the people that had make an "I like" to a certain article of my external website (non facebook). In order to choose the winner I need to know who has made the I like.
This query:
https://api.facebook.com/method/fql.query?query=select%20like_count%20from%20link_stat%20where%20url='myWEBSITE'&format=json
Only get me the total count of I Likes but not the users ID
This query is perfect:
https://api.facebook.com/method/fql.query?query=SELECT%20user_id%20FROM%20like%20WHERE%20object_id%3D%MY_object_ID&access_token=MY_ACCESS_TOKEN
But how do I get an OBJECTID for an external url??
Thanks in advance
Object can be any thing like video, note, link, photo, or album but can not be any FB page or Url.. So I guess its not possible to get the user Id for a URL.
If you are using JS SDK / Like plugin in your website to like it, i think you can subscribe to an event and then use some ajax calls to get those userIds whenever they instantly like it.
See Somnath Muluk's answer in https://stackoverflow.com/a/13467793/269521

Adding Facebook Photo objects to Open Graph Action

I've created a timeline app that adds events to user's timelines in the past. I've noticed its simple to add tags, places, and external images to OG objects and actions.
However, I can't seem to find a good way to connect to a facebook photo (i.e. a photo from the user's albums). Adding a link to the photo's picture in the images field doesn't work the expected way without an access token (which will presumably expire)
For example: /namespace:action?image=http://graph.facebook.com/10100111692798728/picture will show a '?' photo (in aggregations and elsewhere) unless you pass a valid access token in too (that can't work permanently). This is presumably because whatever identity is going out to request the photo is not allowed to access it this way.
It doesn't seem like you can connect your own actions to photo objects either. Is there a solution to this that I've missed. I'd really like user's to be able to add a photo from their facebook albums to an action from my app (i.e. them doing the 'action'). It would be nice if you didn't have to point directly at an image on FB's CDN somewhere, it would be even nicer if there was a way to point directly at the FB open graph object.
Thanks,
Grant
It is possible to connect the action with Facebook photo like this:
POST /me/do:action?object=[objectId]&access_token=[valid access token]
If the [objectId] is an object id of existing photo - it will show the picture and correct link to the full size facebook photo on timeline.

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.