A photo inside a canvas
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>
Field | Description |
---|---|
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_group_key string | The element group key to bundle multiple elements in editing |
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 | Description |
---|---|
368 | The action attempted has been deemed abusive or is otherwise disallowed |
80001 | There have been too many calls to this Page account. Wait a bit and try again. For more info, please refer to https://developers.facebook.com/docs/graph-api/overview/rate-limiting. |
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 |
---|---|---|---|
| Provide a list of products for the photo |
| Yes |
| Product id for tapped photo |
| Yes |
| Spot coordinates on the photo. |
| No. If none specified, there is no spot on the photo |