เวอร์ชันของ API กราฟ

Canvas

การอ่าน

A canvas document

ตัวอย่าง

Graph API Explorer
GET /v26.0/{canvas-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-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-id}",
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/{canvas-id}",
    null,
    HttpMethod.GET,
    new GraphRequest.Callback() {
        public void onCompleted(GraphResponse response) {
            /* handle the result */
        }
    }
).executeAsync();
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                               initWithGraphPath:@"/{canvas-id}"
                                      parameters:params
                                      HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];
หากคุณต้องการเรียนรู้วิธีใช้ API กราฟ โปรดอ่านคู่มือการใช้ API กราฟของเรา

พารามิเตอร์

จุดสิ้นสุดนี้ไม่ต้องพารามิเตอร์ใดๆ

ช่อง

ช่องคำอธิบาย
id
numeric string

ID of the canvas

background_color
string

Background color of the canvas

body_elements
list<CanvasPhoto|CanvasHeader|CanvasVideo|CanvasText|CanvasCarousel|CanvasButton|CanvasFooter|CanvasStoreLocator|CanvasProductList|CanvasProductSet>

Body element nodes for the canvas

business_id
numeric string

The business id for the canvas product set element

canvas_link
string

The canvas link for the canvas

collection_hero_image

First element as photo inside canvas to use as hero media for canvas collection

collection_thumbnails
list<CanvasCollectionThumbnail>

Canvas elements that can be used as thumbnails for canvas collections

element_payload
string

Payload that contains all element

fb_body_elements
list<CanvasPhoto|CanvasHeader|CanvasVideo|CanvasText|CanvasCarousel|CanvasButton|CanvasFooter|CanvasStoreLocator|CanvasProductList|CanvasProductSet|CanvasDynamicProductSet|CanvasTemplateVideo|CanvasDynamicPhoto>

Body element nodes for the canvas, used by FB internal apps and includes elements who's API is not public yet

is_hidden
bool

The canvas is hidden or not

is_published
bool

Publish status of the canvas

last_editor

User who last edited this canvas

linked_documents

The canvas documents that are reachable via buttons/links in this document

name
string

Name used to label the canvas

owner

Page that owns this canvas

property_list
list<string>

List of properties for this canvas

store_url
string

The associated app store URL for the canvas

style_list
list<enum>

Canvas level style attributes

tags
list<string>

Tags associated with Canvas

ui_property_list
list<string>

List of UI properties to set when viewing this canvas from creation tools

unused_body_elements
list<CanvasPhoto|CanvasHeader|CanvasVideo|CanvasText|CanvasCarousel|CanvasButton|CanvasFooter|CanvasStoreLocator|CanvasProductList|CanvasProductSet>

Body element nodes that belong to the canvas but are not used

update_time
int32

Last updated time of the canvas

use_retailer_item_ids
bool

HACK: Flag for whether or not the ad creative that uses this Canvas should use retailer_item_ids or not

จุดเชื่อมโยง

จุดเชื่อมโยงคำอธิบาย
Edge<CanvasPreview>

Get preview HTML embed element

Edge<TextWithEntities>

Get preview notifications for the canvas

Error Codes

ข้อผิดพลาดคำอธิบาย
368The action attempted has been deemed abusive or is otherwise disallowed
100Invalid parameter

การสร้าง

You can make a POST request to canvases edge from the following paths:
When posting to this edge, a Canvas will be created.

พารามิเตอร์

พารามิเตอร์คำอธิบาย
background_color
string
ค่าเริ่มต้น: FFFFFFFF

Background color of the canvas

body_element_ids
list<numeric string or integer>

A list of all canvas element ids inside this canvas

enable_swipe_to_open
boolean
ค่าเริ่มต้น: false

Field used to mark if swipe to open is enabled

hero_asset_facebook_post_id
numeric string or integer

hero_asset_facebook_post_id

hero_asset_instagram_media_id
numeric string or integer

hero_asset_instagram_media_id

is_hidden
boolean

Field used to mark if the canvas is visible or not

is_published
boolean
ค่าเริ่มต้น: false

Field used to mark the publish state of the canvas

name
string
ค่าเริ่มต้น: Untitled Canvas

Field used to label docs by the editor tool

source_template_id
numeric string or integer

ID of EntRichMediaDocumentTemplate that the Canvas document is created from

ประเภทการส่งกลับ

Struct {
id: numeric string,
}

Error Codes

ข้อผิดพลาดคำอธิบาย
105The number of parameters exceeded the maximum for this operation
100Invalid parameter
200Permissions error

กำลังอัพเดต

คุณสามารถอัพเดต a Canvas ได้โดยส่งคำขอ POST ไปที่ /{canvas_id}

พารามิเตอร์

พารามิเตอร์คำอธิบาย
background_color
string

Background color of the canvas

body_element_ids
list<numeric string or integer>

A list of canvas element ids

enable_swipe_to_open
boolean

Field used to mark if swipe to open is enabled

hero_asset_facebook_post_id
numeric string or integer

hero_asset_facebook_post_id

hero_asset_instagram_media_id
numeric string or integer

hero_asset_instagram_media_id

is_hidden
boolean

Field used to hide a (published) canvas

is_published
boolean

Field used to mark the publish state of the canvas

name
string

Field used to label the canvas

source_template_id
numeric string or integer

ID of EntRichMediaDocumentTemplate that the Canvas document is created from

ประเภทการส่งกลับ

This endpoint supports read-after-write and will read the node to which you POSTed.
Struct {
success: bool,
}

Error Codes

ข้อผิดพลาดคำอธิบาย
100Invalid parameter

กำลังลบ

คุณไม่สามารถดำเนินการนี้ที่ปลายทางนี้