Graph API Version

Canvas Photo

Reading

A photo inside a canvas

Permissions

Developers usually request these permissions for this endpoint:

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

Example

Graph API Explorer
GET /v2.11/{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

action

CanvasOpenURLAction

The action associated with the photo

hide_product_prices

bool

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

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

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

Edges

No edges

Validation Rules

ErrorDescription
100Invalid parameter

Creating

You can't perform this operation on this endpoint.

Updating

Example

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

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
200Permissions error
100Invalid parameter
210User not visible

Deleting

Example

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
200Permissions error