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.
Related
On my website there is possible post image from computer. But I would like also provide user to post image from facebook user album. I can imagine some dialog like "Facebook login" which will open faceook images and provide user to send image from facebook to my application. Does something like that possible? Many thanks
Yes, it is possible.
I assume you have a little experience with facebook api.
trigger login FB login window and request user_photos permission
make a query to facebook to get (all/random/a few) user albums like so me/albums?fields=id,count
If a key count is set, there are photos
(I would collect all IDs of albums containing photos and make a query to facebook with ech one ID)
Then again, query to facebook like so /%album-id%?fields=photos.fields(images)
Now you have an array of URLs of images which, for example you show to a user and after he selects, you download it and upload to your server
Since you did not request a solid code, I will provide you with at least with a little snippet, or show an illustration how to do that. http://paste2.org/hvGkngIL. (a metod index) (Might not work properly, since I cut it from a PHP framework I work with)
When pulling photos from a Facebook album via the graph API, i.e.
https://graph.facebook.com/<albumid>/photos?access_token=<token>&limit=999&fields=name,source
For some albums, it only supplies partial results. For instance, an album with 15 photos may only return 13 photos. This call:
https://graph.facebook.com/<albumid>?access_token=<token>&fields=count
...Indeed returns the proper count of 15. My first thought was that perhaps these 2 "missing" photos have more limiting privacy settings, but every photo in the entire album (which is owned by the owner of the token, incidentally) has the same "visible to friends" privacy setting. Most albums do return all photos, as expected.
Any ideas as to what might be causing this behavior?
I was missing 4 photos of 33 for one of my albums. I added 'user_status' to the permissions and it suddenly works.
Instead of the cause of why it happens, I am suggesting you a workaround. Graph api is well known for returning partial results. (You can search for that, and you get hell lot of such issues.)
why not go the FQL way?
Checkout :https://developers.facebook.com/docs/reference/fql/photo/
You can get the id, or direct images links of the pictures in an album in a single query.
Sample : SELECT src_big FROM photo WHERE aid="20531316728_324257"
This returns the url of biggest version of the pictures inside the album.
This should probably solve your problem as long as you are using a user access_token and not app access_token.
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.
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.
Hi All does anyone know the correct Graph path for deleting an album? I have tried a bunch of things and nothing seems to work?
/me/aid
/aid
/me/object_id/albums
/me/object_id
/me/albums/object_id
/object_id/album"
/object_id/albums
/object_id
obviously replacing aid and object_id with a valid value...
Is it possible to delete an album through the Graph API? thanks!
Umm, as far as I can tell, you simply are not allowed to delete an album through the graph API, regardless of permissions.
This has been true for a while.
Recently (its 1/16/12 when I write this), graph API users can't even delete photos.
Here's the Facebook Bug Link:
https://developers.facebook.com/bugs/125524667559003?browse=search_4f14be86ba58f3666689319
Yes, the FB-built apps appear to have special permissions linked to their App IDs to which you do not have access. I just noticed, for instance, that the iOS app uploads photos to a temporary album while you are typing in the caption for the photo so the final "upload" wait is perceived to be just a few seconds (it just moves the picture to the mobile uploads album and set the privacy). Access to anything like a temp album is not available through any API I can see.
Filing a bug report is about all you can do.
I would be happy to have this answer down voted as not correct, but I have spent a reasonable amount of time not just looking at the docs, but watching what the iOs app is doing through a proxy server and trying to recreate it.
From Facebook's documentation:
You can delete objects in the graph by issuing HTTP DELETE requests to the object URLs, i.e,
DELETE https://graph.facebook.com/ID?access_token=... HTTP/1.1
To support clients that do not support all HTTP methods (like JavaScript clients), you can alternatively issue a POST request to an object URL with the additional argument method=delete to override the HTTP method. For example, you can delete a comment by issuing a POST request to https://graph.facebook.com/COMMENT_ID?method=delete.
You can delete a like by issuing a DELETE request to /POST_ID/likes (since likes don't have an ID).
So the last one of your paths is the correct one '/object_id'. You need to make sure you are either sending your HTTP request as a "DELETE" or as a "POST" with the query parameter method=delete set. For example:
DELETE https://graph.facebook.com/ID?access_token=
or
POST https://graph.facebook.com/ID?method=delete&access_token=
If neither of those work, make sure you have the correct extended permission. I believe the permission you need to delete an album is 'publish_stream'. I have never done it before so I could be wrong on that one.
If you are using the Facebook C# SDK you would do it like this:
var client = new FacebookClient('access_token');
dynamic result = client.Delete('object_id');
I think you could read the ID of a certain album by /me/albums/ and after that run the delete on https://graph.facebook.com/ID
On my try it worked just fine...
To delete objects via the AS3 Facebook API, use the deleteObject(method,callback) function of the Facebook object.