An individual photo as represented in the Graph API.
To read the 'photo' object you need
access_token if it is publicuser_photos permission to access photos and albums uploaded by the user, and photos in which the user has been taggedfriends_photos permission to access friends' photos and photos in which the user's friends have been taggedTo publish a 'photo' object you need
access tokenpublish_stream permissionWith that granted, you can upload a photo by issuing an HTTP POST request with the photo content and an optional description to one these to Graph API connections:
https://graph.facebook.com/USER_ID/photos - The photo will be published to an album created for your app. We automatically create an album for your app if it does not already exist. All photos uploaded this way will then be added to this same album.
https://graph.facebook.com/ALBUM_ID/photos - The photo will be published to a specific, existing photo album, represented by the ALBUM_ID. Regular albums have a size limit of 200 photos. Default application albums currently do not have a size limit, but please adhere to our policies to not abuse this feature.
You can also publish a photo by providing a url param with the photo's URL.
A photo from a Facebook Page album:
https://graph.facebook.com/10151509108346729
The Photo object has the following fields.
| Name | Description | Permissions | Returns |
id | The photo ID | generic |
|
from | The profile (user or page) that posted this photo | generic | object containing |
tags | The tagged users and their positions in this photo | generic |
|
name | The user provided caption given to this photo - do not include advertising in this field | generic |
|
name_tags | An array containing an array of objects mentioned in the | generic |
|
icon | The icon that Facebook displays when photos are published to the Feed | generic |
|
picture | The thumbnail-sized source of the photo | generic |
|
source | The source image of the photo - currently this can have a maximum width or height of 720px, increasing to 960px on 1st March 2012 | generic |
|
height | The height of the photo in pixels | generic |
|
width | The width of the photo in pixels | generic |
|
images | The 4 different stored representations of the photo | Requires |
|
link | A link to the photo on Facebook | generic |
|
place | Location associated with a Photo, if any | generic |
|
created_time | The time the photo was initially published | generic |
|
updated_time | The last time the photo or its caption was updated | generic |
|
The Photo object has the following connections.
| Name | Description | Permissions | Returns |
| comments | All of the comments on this photo. | any valid |
|
| likes | Users who like this photo. | any valid |
|
| picture | The album-sized view of the photo. | any valid | HTTP 302 redirect to the URL of the picture |
| tags | The Users tagged in the photo. | any valid | Tags with names and IDs (if available). |
You can write to the PHOTO_ID/comments connection to post a comment to the photo by issuing an HTTP POST request with the publish_stream permission and following parameters.
| Parameter | Description | Type | Required |
|---|---|---|---|
message |
Comment text | string |
yes |
If the write is successful, you get the following return.
| Name | Description | Type |
|---|---|---|
id |
The new comment ID | string |
You can like a photo by issuing a HTTP POST request to PHOTO_ID/likes connection with the publish_stream permission. No parameters necessary.
If the write is successful, you get the following return.
| Description | Type |
|---|---|
| If the like succeeded | boolean |
You can unlike an photo by issuing an HTTP DELETE request to the PHOTO_ID/likes connection with the publish_stream permission.
If the delete is successful, you get the following return.
| Description | Type |
|---|---|
| If the unlike succeeded | boolean |
You can create a tag on the photo by issuing an HTTP POST request to the tags connection, PHOTO_ID/tags.
Note: This feature is intended to help users tag their friends in real photos. You should not use this feature to encourage users to tag their friends if their friends are not actually in that photo, or to tag friends in composite photos. If your app is found to be encouraging this behavior, your usage of this feature may be disabled.
You can specify which user to tag using two methods: in the URL path as PHOTO_ID/tags/USER_ID, or in a URL parameter as PHOTO_ID/tags?to=USER_ID. To add several tags at once, you can specify a tags property which contains an array of tags like so PHOTO_ID/tags?tags=[{"tag_uid":"1234"}, {"tag_uid":"12345"}]. Currently, you cannot tag a Page in a photo using this API.
Tagging a photo requires the user_photos and publish_stream permissions, publish_stream is optional - if not present, the tag will go through Tag Review of the tagged person if s/he has this privacy setting enabled. Tagging a photo supports the following parameters.
| Parameter | Description | Type | Required |
|---|---|---|---|
to |
USER_ID of the User to tag; can also be provided in URL path (see above). | string |
One of to or tag_text |
tag_text |
A text string to tag. | string |
One of to or tag_text |
x |
x coordinate of tag, as a percentage offset from the left edge of the picture | number |
no |
y |
y coordinate of tag, as a percentage offset from the top edge of the picture | number |
no |
If the write is successful, you get the following return.
| Description | Type |
|---|---|
| If the update succeeded | boolean |
You can update the position of a tag for a particular user in the photo by issuing a HTTP POST request to /PHOTO_ID/tags/USER_ID or PHOTO_ID/tags?to=USER_ID with updated x and y coordinates.
Updating a tag on a photo requires the publish_stream permission and supports the following parameters.
| Parameter | Description | Type | Required |
|---|---|---|---|
to |
USER_ID of the User to tag; can also be provided in URL path (see above). | string |
yes |
x |
x coordinate of tag, as a percentage offset from the left edge of the picture | number |
no |
y |
y coordinate of tag, as a percentage offset from the top edge of the picture | number |
no |
If the update is successful, you get the following return.
| Description | Type |
|---|---|
| If the update succeeded | boolean |
You can delete a tag for a particular user in the photo by issuing a HTTP DELETE request to /PHOTO_ID/tags/USER_ID or PHOTO_ID/tags?to=USER_ID.
Deleting a tag on a photo requires the publish_stream permission and supports the following parameters.
| Parameter | Description | Type | Required |
|---|---|---|---|
to |
USER_ID of the User to tag; can also be provided in URL path (see above). | string |
yes |
If the deletion is successful, you get the following return.
| Description | Type |
|---|---|
| If the deletion succeeded | boolean |
https://graph.facebook.com/10150146071831729 (A photo from a Facebook Page album)