I am successfully uploading photos with my iPhone App and the corresponding Graph API calls, and it ends up properly in an (automatically created) album "appName Photos" on a new account w/o existing albums. Uploading to my own account, however, puts the photo to "Camera + Photos", the first of multiple albums existing for my account, instead of creating a new one for my app.
Anything I need to consider specifically to enforce creation of an app-related album? Do I need to go through an explicit album creation process first? I thought all the required information would be provided by the logon procedure, containing the appID (and seemingly does when using the "empty" account)?
EDIT:
I just had the albums programmatically listed, and actually an according album WAS created and is returned in the list of albums now, however it does not show up and contains no photos. So maybe it is rather a bug that the actual upload is taking place to the next album in the row (maybe some race condition on the FB side)?
Thx for insight, habitoti
By default, it should work that way (as described in the docs) but it appears to be a recent change to no longer enforce creation of an app-related album but to use a default album for all posted photos that aren't explicitly added to a specific album.
You'll want to use the procedure described here (look at the second chunk of code) to ensure that it creates an application-named album.
Related
Is there any way to find out if a user has changed his/her profile picture since a time given? I mean, is there a proper way to achieve that using Facebook API?
One solution would be to store image id when user registers and later with CRON do a query to see if current profile picture id is the same id as one stored, if different then used changed the profile picture.
Second solution is to have access to user feed and from there to check if profile picture was changed, also CRON will be used.
Note: if you plan to use user picture in your app there is no need to check if picture was changed, facebook will always send you the current one.
You should check ETags. It is some kind of has witch you get in response header. You should store that value and send it next time you make request for image. If image was not changed you will get 304 - Not Modified response from Facebook API.
If you do not want to download images from Facebook you should use ?redirect=false paramter in Facebook image request (eg. https://graph.facebook.com/<username>/picture?redirect=false). This will return json data of profile picture instead of returning the whole image.
I'm stuck with this problem for several weeks now and will try to give a short and detailed explanation below:
Situation
Users visiting the websites and has the option to generate an image with the GD-library. So every users generated a personal image. Simple... until now. After generating the image, the user gets the option to share this image to Facebook. This is done via the OpenGraph protocol.
What's working (Yeah!)
Generating the image is working perfectly fine. Sharing something to Facebook is working also.
Problem
Although the following code is used on sharing the image (fbrefresh=CAN_BE_ANYTHING). FB stills pulls an old image. Sometimes this is a really old image, sometimes it's a more current generated image. But never the just generated image.
And now?
As said I've already tried the fbrefresh=CAN_BE_ANYTHING. Also in de debug tool the right image isn't showing up, but this is probably because the generated image has an unique ID generated from the users cookie. So this id is only usable when the users clicks on generate and after that shares the generated image.
Is there any example on the internet that uses the same sort of strategy and is working? I've searched half the internet and didn't found it yet it's becoming more and more frustrating.
After generating the image, the user gets the option to share this image to Facebook. This is done via the OpenGraph protocol.
What exactly do you mean by the latter? Are you just uploading that image to the user’s wall/one of their albums, or are you publishing an Open Graph object with a user-generated photo attached? (Btw., user-generated photo is meant literally for OG actions – you should only do it with photos that the user has taken using f.e. their mobile phone camera while they where undertaking the action. I doubt if a GDlib-generated image fits into that description.)
Although the following code is used on sharing the image (fbrefresh=CAN_BE_ANYTHING). FB stills pulls an old image.
And by “pull” you mean what exactly, again? Do you upload the photo as an HTTP POST upload, do you upload it by URL, did you specify it as og:image for an OG object, or do you pass it as user-generated photo while publishing an action?
Now, usually the easiest way for resources referenced by a URL to get properly refreshed by the requesting client, is to attach a different value to the query string/as a GET parameter – f.e. the current unix timestamp: …/image.php?1984372634 or …/image.php?foo=bar&forcerefresh=1984372634
Since this value changes every second, it makes each of those URLs a different URL, and the requesting client absolutely has no choice but to request that resource, because he can not have it in its cache already.
I am wondering if it is safe to cache Facebook graph items and not have to check if they have been changed.
For example, if I download and cache of photo with the ID 1234309932123, is it safe to assume that the image for that ID will always be the same?
I assume that a given Facebook object cannot change, it can only be deleted. Is that correct?
It is wrong to assume that photo object will not change. Photo is not only image but associated data as well, at least some of properties for photo can be changed: title, description, people/pages tags.
One more thing that can be changed aside of photo details is access permissions. Platform policies states that you should only show data retrieved from Facebook to people who have permission to view it, so caching photo may became an issue.
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.
I need to know if it's possible to change the caption of a picture uploaded in facebook.
I could upload without trouble, but now I want to change the caption using the facebook graph api. Is it possible?
Thanks
It looks like the name field is what you want to POST to, in order to change the caption: https://developers.facebook.com/docs/reference/api/photo/
However, they don't support writing to it. The things you can write are listed here: https://developers.facebook.com/docs/reference/api/#publishing
It is possible to upload the photo with a new caption, but it looks as if the user has to approve the addition of a photo to his album, and I'm not sure that part is automatable.
Also, Facebook has blocked the ability to delete photos via the Graph API; so even with the approval barrier above you could not delete the photo with the old caption and upload it with a new caption, in order to effectively change the caption. The error message on sending the correct DELETE command is: {"error":{"type":"OAuthException","message":"(#3) Application does not have the capability to make this API call."}}
So the short answer is "it is apparently not possible as of June 11 2011".