Graph API Version

Canvas Photo

Reading

A photo inside a canvas

Example

Graph API Explorer
GET /v8.0/{canvas-photo-id} HTTP/1.1
Host: graph.facebook.com
/* PHP SDK v5.0.0 */
/* make the API call */
try {
  // Returns a `Facebook\FacebookResponse` object
  $response = $fb->get(
    '/{canvas-photo-id}',
    '{access-token}'
  );
} catch(Facebook\Exceptions\FacebookResponseException $e) {
  echo 'Graph returned an error: ' . $e->getMessage();
  exit;
} catch(Facebook\Exceptions\FacebookSDKException $e) {
  echo 'Facebook SDK returned an error: ' . $e->getMessage();
  exit;
}
$graphNode = $response->getGraphNode();
/* 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
id
numeric string

The id of the element

action
CanvasOpenURLAction

The action associated with the photo

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_type
enum

The type of the element

hide_product_prices
bool

Flag to determine whether or not to hide prices for tagged products

name
string

The name of the element

photo

The facebook photo node

product_tags
list<CanvasProductTag>

The product tags on the photo

style
enum

The presentation style of the photo node

top_padding
numeric string

The padding above the element

Validation Rules

ErrorDescription
100Invalid parameter
368The action attempted has been deemed abusive or is otherwise disallowed

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

ParameterDescription
bottom_padding
float

The padding below the photo element

deep_link
string

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

hide_product_prices
boolean

A flag to determine whether or not to show the price of proudcts that are tagged in this photo

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

product_tags
list<Object>

The products tagged with the photo

product_id
numeric string or integer

Required
coordinates
list<float>

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,
}

Validation Rules

ErrorDescription
100Invalid parameter
200Permissions error

Deleting

You can't perform this operation on this endpoint.