Graph API Version

Canvas Photo

Reading

A photo inside a canvas

Example

use FacebookAds\Api;
use FacebookAds\Http\RequestInterface;

$params = array(
  'fields' => array(
    'action',
    'id',
    'name',
    'photo',
  ),
);

$data = Api::instance()->call(
  '/' . <CANVAS_PHOTO_ID>,
  RequestInterface::METHOD_GET,
  $params)->getContent();
curl -G \
  --data-urlencode 'fields=[ 
    "action", 
    "id", 
    "name", 
    "photo" 
  ]' \
  -d 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/v2.11/<CANVAS_PHOTO_ID>

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

Error Codes

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

Error Codes

ErrorDescription
100Invalid parameter

Deleting

You can't perform this operation on this endpoint.

Add Product Tags

Create an ads experience that mimics browsing a printed, lifestyle catalog featuring desired products to promote. You can tag featured products in the image and a tag appears on the image.

This API is available on a limited basis to partners and advertisers that are on the allow list. Contact your Facebook representative if you want to use this API.

When someone taps the tag, a thumbnail for that product appears in a rotating group of thumbnails, including all tagged products. Someone can tap the thumbnail to be taken to the product's product detail page. This uses the photo with product tags element API. For example:

curl -F 'canvas_photo={ "bottom_padding": 20, "name": "Instant Experience Photo Name", "open_url_action": {"url":"URL"}, "photo_id": "PHOTO_ID", "style": "FIT_TO_WIDTH", "top_padding": 20, "product_tags": "[{product_id: PRODUCT_ID, coordinates: [0.65, 0.58]}, {product_id: PRODUCT_ID}]" }' }' -F 'access_token=ACCESS_TOKEN' https://graph.facebook.com/VERSION/PAGE_ID/canvas_elements

The options available for product tags are:

Field Name Description Type Required

product_tags

Provide a list of products for the photo

array

Yes

product_id

Product id for tapped photo

number

Yes

coordinates

Spot coordinates on the photo.

array, where x and y greater than zero and less than 1

No. If none specified, there is no spot on the photo