Upload album to facebook from another website - facebook

Assume that I have know about FB API, I just want to ask "any way to upload album to FB from my website?".
Ex: xkcn.info/archive is my website, I develop a checkbox function that allow user can mark pictures and upload to facebook, it create an album or photo...;).
Thank a lot.

Yes of course it is possible.
First of all you need the permissions:
user_photos to get the access to the user's album
publish_stream to post photos to an album
You can create an empty album of a page by issuing an HTTP Post request to me/albums with following parameters:
name- The name of the album
message- The description of the album
In return you will get the album_id which you can use to post photos into
You can add photos to an album by issuing an HTTP POST request to ALBUM_ID/photos with following parameters:
source- Photo content (multipart/form-data)
message- Photo description string
Reference: Album

Related

Posting photos on a facebook page album using graph api

Here's what I've done:
Get page access token from /me/account
Paste in on the graph explorer tool.
Make a post request with parameters named message, url (trying to upload via url) to http://graph.facebook.com/{albumid}/photos.
Graph returned a Id.
Figured out the problem. We need to approve the photos from by going to the album as the Page.

FB Photo Application and Album creation linkage

I have a sample application that uploads photos to a user's FB account. Of course, FB creates an album with the name of the app and loads the photos in that album.
If the user changes the name of the album, then FB still uploads photos to the same album (although the album has been renamed).
How does FB know which album belongs to my application? There are no obvious signs of linkage between my appid and the album ids / links that FB creates for the album.
Thanks in advance.
SS
There's likely an association on the backend between the AppID and the AlbumID.
There's no simple way to know your app albumID.
Three suggestions for you:
Allow the user to choose the album to upload the photo to. You can do this by uploading to albumid/photos instead of me/photos.
If you want to know your album, once you have uploaded one photo, you can use the returned ID along with FQL to query the photo table. This works independently of album and will let you query on object_id and return the album object id. e.g., SELECT album_object_id from photo where object_id = '(yourobjectid)' Store this, it won't change.
Upload a tiny test photo and use the method from 2 above. This will let you know your current album id. Then delete the tiny test photo.
Hope this helps.

Get the name of the album from a tagged photo using Graph API

I am able to grab album name and photos uploaded by the user using the graph api.
When I use "https://graph.facebook.com/me/photos?access_token=".$access_token", I get all the tagged photos of the user. Is there a way to get the name of the album of a photo, which has not been uploaded by the user but by his friend?
Thanks
I don't think you can get that directly, but using the "link" attribute you can quickly suss it out, as seen in this example:
"link": "http://www.facebook.com/photo.php?fbid=10150154222339657&set=a.358879884656.199726.249427954656&type=1"
That set parameter and fbid tell you much more about the photo.
You can view more details about the photo by going to the page for it. It will tell you the position in the album, though it still won't have the album:
http://graph.facebook.com/10150154222339657
You can however determine the album id from the set parameter, the album id is the between the a. and the second ., so in this example the album id is 358879884656
So, the album info would be available at:
http://graph.facebook.com/358879884656

how to post photo with text to facebook wall

Current, I can upload a photo to an user's album. but I can't use the url of this photo(assemble the url by the photo id), it says:"FBCDN image is not allowed in stream", I also figured out that facebook forbid user to do this.
I know that I can upload the photo to somewhere else on the internet, but actually I don't have that 'somewhere', so how does everybody do ?
You dont need to assemble the url of the picture you just uploaded. Instead, use the photo_id that you got back and make another call to the Graph api :
https://graph.facebook.com/{PHOTO_ID}
The response from that call will contain all the information you need (including a link to the photo on facebook).

Is it possible to download all of my photos on facebook through facebook graph api?

I want to download all of my photos and albums from facebook in a programatic way.
I know its possible to push photos to fb through graph api. I was wondering if it is possible to pull photos as well.
Yes. First you would have to get all the albums:
https://graph.facebook.com/me/albums?access_token=
Then you would have to request the list of photos in each album:
https://graph.facebook.com/album_Id_here/photos?access_token=
The result of the last request will give you a JSON object that contains urls of each photo in the album.
See the documentation here: http://developers.facebook.com/docs/reference/api/