圖形 API 版本

Page Canvas Elements

閱讀中

PageCanvasElements

新粉絲專頁體驗

This endpoint is supported for 新粉絲專頁體驗.

範例

Graph API Explorer
GET /v22.0/{page-id}/canvas_elements 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(
    '/{page-id}/canvas_elements',
    '{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(
    "/{page-id}/canvas_elements",
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/{page-id}/canvas_elements",
    null,
    HttpMethod.GET,
    new GraphRequest.Callback() {
        public void onCompleted(GraphResponse response) {
            /* handle the result */
        }
    }
).executeAsync();
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                               initWithGraphPath:@"/{page-id}/canvas_elements"
                                      parameters:params
                                      HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];
如果想瞭解如何使用圖形 API,請參閱我們的使用圖形 API 指南

參數

這個端點沒有任何參數。

欄位

由此關係連線進行的閱讀將回傳 JSON 格式結果:

{ "data": [], "paging": {} }

data

CanvasBodyElement 節點的清單。

paging

如需更多有關分頁的詳細資料,請參閱圖形 API 指南

Error Codes

錯誤說明
100Invalid parameter

建立中

You can make a POST request to canvas_elements edge from the following paths:
發佈到此關係連線時,會建立 a CanvasBodyElement

參數

參數說明
canvas_button
Object

Create a canvas button that belongs to a page

name
string
預設值:Button

Name of the button

button_color
string
預設值:FF000000

The color of the button

rich_text
Object

The text inside the button

必填
button_style
enum {BUTTON_OUTLINE, BUTTON_FILLED}
預設值:BUTTON_OUTLINE

The style of the button

open_url_action
Object

the destination url after user clicks the button, by setting this, the canvas button will have action with OPEN URL type

text_alignment
enum {LEFT, CENTER, RIGHT}
預設值:CENTER

The alignment of the text on the button

text_color
string
預設值:FF777777

The color of the text on the button

font_size
int64
預設值:15

The size of the font for the text on the button

font_family
string
預設值:sans-serif

The font family of the text on the button

line_height
float
預設值:1

The line height of the text on the button

top_padding
float
預設值:0

The padding above the button

deep_link
string

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

bottom_padding
float
預設值:0

The padding below the button

background_color
string
預設值:FFFFFFFF

Background color of the button

canvas_carousel
Object

Create a canvas carousel that belongs to a page

name
string
預設值:Carousel

Name of the carousel element

child_elements
list<id>

The child elements of the carousel. Typically, they are canvas photo elements

必填
style
enum {FIT_TO_WIDTH, FIT_TO_HEIGHT}
預設值:FIT_TO_WIDTH

The presentation style of the carousel

top_padding
float
預設值:0

The padding above the carousel

bottom_padding
float
預設值:0

The padding below the carousel

canvas_footer
Object

Create a canvas footer that belongs to a page

name
string
預設值:Footer

Name of the footer element

child_elements
list<id>

The child elements inside a footer, typically, it is a canvas button element.

必填
background_color
string
預設值:FFFFFFFF

Background color of the button

canvas_header
Object

Create a canvas header that belongs to a page

name
string
預設值:"Header"

Name of the header element

child_elements
array<numeric string>

The child elements (typically a photo) inside the header

background_color
string

The background color of the header

canvas_lead_form
Object

The id of corresponding published lead form

leadgen_data_id
leadgen_data ID

必填
name
string
預設值:"Lead Gen Form"

top_padding
float
預設值:0

bottom_padding
float
預設值:0

canvas_photo
Object

Create a canvas photo that belongs to a page

photo_id
id

ID of Facebook photo used in the photo element

open_url_action
Object

The action associated with the photo

deep_link
string

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

destination_set_id
id

style
enum {FIT_TO_WIDTH, FIT_TO_WIDTH_EXPANDABLE, FIT_TO_HEIGHT}

The presentation style of the photo

name
string
預設值:Photo

Name of the photo element

top_padding
float
預設值:0

The padding above the photo element

bottom_padding
float
預設值:0

The padding below the photo element

product_tags
list<Object>

product_id
numeric string or integer

必填
coordinates
list<float>

hide_product_prices
boolean

canvas_product_list
Object

Creat a canvas product list that belongs to a page

name
string
預設值:Product

product_id_list
list<int64>

top_padding
float
預設值:0

bottom_padding
float
預設值:0

item_headline
string
預設值:

item_description
string
預設值:

canvas_product_set
Object

Creat a canvas product set that belongs to a page

name
string
預設值:Product

Name of the product set element

max_items
int64
預設值:50

Maximum number of products to show

product_set_id
id

The product set id which contains a subset of products within a product catalog

top_padding
float
預設值:0

The padding above the product set

bottom_padding
float
預設值:0

The padding below the product set

image_overlay_spec
Object

How to render overlays over a product item

overlay_template
enum {PILL_WITH_TEXT, CIRCLE_WITH_TEXT, TRIANGLE_WITH_TEXT}

必填
text_type
enum {PRICE, STRIKETHROUGH_PRICE, PERCENTAGE_OFF, CUSTOM, FROM_PRICE, DISCLAIMER, GUEST_RATING, STAR_RATING, SUSTAINABLE, AUTOMATED_PERSONALIZE}

必填
text_font
enum {DROID_SERIF_REGULAR, LATO_REGULAR, NUNITO_SANS_BOLD, OPEN_SANS_BOLD, OPEN_SANS_CONDENSED_BOLD, PT_SERIF_BOLD, ROBOTO_MEDIUM, ROBOTO_CONDENSED_REGULAR, NOTO_SANS_REGULAR, DYNADS_HYBRID_BOLD}

必填
position
enum {TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT, BOTTOM_RIGHT}

必填
theme_color
enum {BACKGROUND_E50900_TEXT_FFFFFF, BACKGROUND_F78400_TEXT_FFFFFF, BACKGROUND_00AF4C_TEXT_FFFFFF, BACKGROUND_0090FF_TEXT_FFFFFF, BACKGROUND_755DDE_TEXT_FFFFFF, BACKGROUND_F23474_TEXT_FFFFFF, BACKGROUND_595959_TEXT_FFFFFF, BACKGROUND_000000_TEXT_FFFFFF, BACKGROUND_FFFFFF_TEXT_C91B00, BACKGROUND_FFFFFF_TEXT_F78400, BACKGROUND_FFFFFF_TEXT_009C2A, BACKGROUND_FFFFFF_TEXT_007AD0, BACKGROUND_FFFFFF_TEXT_755DDE, BACKGROUND_FFFFFF_TEXT_F23474, BACKGROUND_FFFFFF_TEXT_646464, BACKGROUND_FFFFFF_TEXT_000000}

必填
float_with_margin
boolean

text_template_tags
array<string>

custom_text_type
enum {FREE_SHIPPING, POPULAR, SALE}

item_headline
string
預設值:

item_description
string
預設值:

retailer_item_ids
list<string>

show_in_feed
boolean

storefront_setting
JSON object

enable_sections
boolean
預設值:false

enable_sections

canvas_store_locator
Object

Create a canvas store locator that belongs to a page

name
string
預設值:Store Locator

Name of the store locator element

typeface
string
預設值:HelveticaNeue-Light

Font used to display info about the store

header_background_color
string
預設值:FF000000

Header background color for the store locator

canvas_template_video
Object

Create a template video that belongs to a page

name
string
預設值:"Automatic Video"

product_set_id
numeric string

必填
template_video_spec
Object

必填
customization
JSON object {string : string}

top_padding
float
預設值:0

bottom_padding
float
預設值:0

canvas_text
Object

Create a canvas text that belongs to a page

name
string
預設值:Text

Name of the text element

rich_text
Object

The text content of the text element

必填
text_alignment
enum {LEFT, CENTER, RIGHT}
預設值:CENTER

The alignment of the text

text_color
string
預設值:FF777777

The color of the text

font_size
int64
預設值:15

The size of the font for the text

font_family
string
預設值:sans-serif

The font family of the text

line_height
float
預設值:1

The line height of the text

top_padding
float
預設值:0

The padding above the text

bottom_padding
float
預設值:0

The padding below the text

background_color
string

The color of the background for the text

canvas_video
Object

Create a canvas video that belongs to a page

name
string
預設值:Video

Name of the video element

video_id
id

ID of Facebook video used in the video element

video_url
URI

style
enum {FIT_TO_WIDTH, FIT_TO_HEIGHT}
預設值:FIT_TO_WIDTH

The presentation style of the video

top_padding
float
預設值:0

The padding above the video

bottom_padding
float
預設值:0

The padding below the video

傳回類型

此端點支援寫入後讀取功能,並將讀取傳回類型表示為 id 的節點。
Struct {
id: numeric string,
}

Error Codes

錯誤說明
100Invalid parameter
368The action attempted has been deemed abusive or is otherwise disallowed
200Permissions error
283That action requires the extended permission pages_read_engagement and/or pages_read_user_content and/or pages_manage_ads and/or pages_manage_metadata
190Invalid OAuth 2.0 Access Token
210User not visible
104Incorrect signature
80001There 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.

更新中

你無法在此端點執行此操作。

刪除中

你無法在此端點執行此操作。