Graph API Version

Canvas Photo

Reading

A photo inside a canvas

Permissions

Developers usually request these permissions for this endpoint:

Marketing Apps
  • ads_management
Page management Apps
No data
Other Apps
No data

Examples

Graph API Explorer
GET /v2.9/{canvas-photo-id} HTTP/1.1
Host: graph.facebook.com
/* PHP SDK v5.0.0 */
/* make the API call */
$request = new FacebookRequest(
  $session,
  'GET',
  '/{canvas-photo-id}'
);
$response = $request->execute();
$graphObject = $response->getGraphObject();
/* handle the result */
/* make the API call */
FB.api(
    "/{canvas-photo-id}",
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/{canvas-photo-id}",
    null,
    HttpMethod.GET,
    new GraphRequest.Callback() {
        public void onCompleted(GraphResponse response) {
            /* handle the result */
        }
    }
).executeAsync();
// For more complex open graph stories, use `FBSDKShareAPI`
// with `FBSDKShareOpenGraphContent`
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                               initWithGraphPath:@"/{canvas-photo-id}"
                                      parameters:params
                                      HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];
If you want to learn how to use the Graph API, read our Using Graph API guide.

Parameters

This endpoint doesn't have any parameters.

Fields

FieldDescription

action

CanvasOpenURLAction

The action associated with the photo

id

numeric string

The id of the element

bottom_padding

numeric string

The padding below the element

deep_link

string

Deep link destination only for mobile apps (used for mobile install or engagement ads, and app link is supported)

element_group_key

string

The element group key to bundle multiple elements in editing

element_type

enum

The type of the element

name

string

The name of the element

photo

The facebook photo node

style

enum

The presentation style of the photo node

top_padding

numeric string

The padding above the element

Edges

No edges

Validation Rules

ErrorDescription
100Invalid parameter

Creating

You can't perform this operation on this endpoint.

Updating

You can update a CanvasPhoto by making a POST request to /{canvas_photo_id}.

Parameters

NameDescription
bottom_padding
float

The padding below the photo element

name
string

Name of the photo element

open_url_action
Object

The action associated with the photo

photo_id
id

ID of Facebook photo used in the photo element

style
enum {FIT_TO_WIDTH, FIT_TO_WIDTH_EXPANDABLE, FIT_TO_HEIGHT}

The presentation style of the photo

top_padding
float

The padding above the photo element

Return Type

This endpoint supports read-after-write and will read the node to which you POSTed.
Struct {
success: bool,
}

Deleting

You can delete a CanvasPhoto by making a DELETE request to /{canvas_photo_id}.

Parameters

This endpoint doesn't have any parameters.

Return Type

Struct {
success: bool,
}

Validation Rules

ErrorDescription
210User not visible