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

Ad Set Copies

Create a duplicate ad set based on an existing one.

The Marketing API has it is own rate limiting logic. If you are encountering errors mentioning a reached limit, see Rate Limiting.

การอ่าน

Endpoint to read the copies of an Ad Set.

ตัวอย่าง

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

พารามิเตอร์

พารามิเตอร์คำอธิบาย
date_preset
enum{today, yesterday, this_month, last_month, this_quarter, maximum, data_maximum, last_3d, last_7d, last_14d, last_28d, last_30d, last_90d, last_week_mon_sun, last_week_sun_sat, last_quarter, last_year, this_week_mon_today, this_week_sun_today, this_year}

Preset date range used to aggregate insights metrics

effective_status
list<enum{ACTIVE, PAUSED, DELETED, PENDING_REVIEW, DISAPPROVED, PREAPPROVED, PENDING_BILLING_INFO, CAMPAIGN_PAUSED, ARCHIVED, ADSET_PAUSED, IN_PROCESS, WITH_ISSUES}>

Filter adsets by effective status

is_completed
boolean

Filter adsets by completed status

time_range
{'since':YYYY-MM-DD,'until':YYYY-MM-DD}

Time range used to aggregate insights metrics

since
datetime

A date in the format of "YYYY-MM-DD", which means from the beginning midnight of that day.

until
datetime

A date in the format of "YYYY-MM-DD", which means to the beginning midnight of the following day.

ช่อง

การอ่านจากจุดเชื่อมโยงนี้จะให้ผลลัพธ์ที่อยู่ในรูปแบบ JSON:

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

data

รายชื่อของโหนด AdSet

paging

หากต้องการทราบข้อมูลเพิ่มเติมเกี่ยวกับการแบ่งหน้า โปรดดูคำแนะนำ API กราฟ

summary

ข้อมูลโดยรวมเกี่ยวกับจุดเชื่อมโยง เช่น จำนวนนับ ระบุช่องกรอกข้อมูลเพื่อดึงข้อมูลในพารามิเตอร์สรุป (เช่น summary=insights)

ช่องคำอธิบาย
insights
Edge<AdsInsights>

Analytics summary for all objects

total_count
unsigned int32

Total number of objects

Error Codes

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

การสร้าง

If you are coping an adset that already finished, the copy will be scheduled to start at the creation's time with the same duration of the original adset.

Asynchronous

This endpoint supports asynchronous batch requests, which enables you to send up to 50 requests in a single HTTP request. If you want to copy large amount of objects, you should use asynchronous batch request. To do so, set deep_copy to true, and you can copy the adset and all of its ads in one sub-request. For example if you have two adsets and each of them has 50 ads, you can copy 2 adsets and all their ads:

curl -F 'access_token=...'\
-F 'asyncbatch=[{ "method":"POST", "relative_url":"<ad-set-id>/copies","name":"async_copy1", body":"name=copy_adset_1&deep_copy=true" },{ "method":"POST", "relative_url":"<ad-set-id>/copies","name":"async_copy2", body": "name=copy_adset_2&deep_copy=true"}]' \
https://graph.facebook.com/<VERSION>

Targeting DSA Regulated Locations (European Union)

To copy an ad set targeted in the European Union's Digital Services Act (DSA) regulated locations, please set the payor/beneficiary information first. Otherwise the copying request may respond with one of the following errors:

Payor missing error

{
  "error": {
    "message": "Invalid parameter",
    "type": "FacebookApiException",
    "code": 100,
    "error_data": "{\"blame_field_specs\":[[\"dsa_payor\"]]}",
    "error_subcode": 3858079,
    "is_transient": false,
    "error_user_title": "No payor provided in DSA regulated region",
    "error_user_msg": "The DSA requires ads to provide payor information in regulated regions. Updating/creating ad needs to provide payor of the ad.",
    "fbtrace_id": "fbtrace_id"
  },
  "__fb_trace_id__": "fbtrace_id",
  "__www_request_id__": "request_id"
}
Beneficiary missing error
{
  "error": {
    "message": "Invalid parameter",
    "type": "FacebookApiException",
    "code": 100,
    "error_data": "{\"blame_field_specs\":[[\"dsa_beneficiary\"]]}",
    "error_subcode": 3858081,
    "is_transient": false,
    "error_user_title": "No payor/beneficiary provided in DSA regulated location",
    "error_user_msg": "The DSA requires ads to provide beneficiary information in regulated regions. Updating/creating ad needs to provide beneficiary of the ad.",
    "fbtrace_id": "fbtrace_id"
  },
  "__fb_trace_id__": "fbtrace_id",
  "__www_request_id__": "request_id"
}

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

พารามิเตอร์

พารามิเตอร์คำอธิบาย
campaign_id
numeric string or integer

Single ID of a campaign to make parent of the copy. The copy inherits all campaign settings, such as budget from the parent.Ignore if you want to keep the copy under the original campaign parent.

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

Whether to copy all the child ads. Limits: the total number of children ads to copy should not exceed 3 for a synchronous call and 51 for an asynchronous call.

end_time
datetime

The end time of the set, e.g. 2015-03-12 23:59:59-07:00 or 2015-03-12 23:59:59 PDT. UTC UNIX timestamp. When creating a set with a daily budget, specify end_time=0 to set the set to be ongoing without end date. If not set, the copied adset will inherit the end time from the original set

rename_options
JSON or object-like arrays

Rename options

rename_strategy
enum {DEEP_RENAME, ONLY_TOP_LEVEL_RENAME, NO_RENAME}
ค่าเริ่มต้น: ONLY_TOP_LEVEL_RENAME

DEEP_RENAME: will change this object's name and children's names in the copied object. ONLY_TOP_LEVEL_RENAME: will change the this object's name but won't change the children's name in the copied object. NO_RENAME: will change no name in the copied object

rename_prefix
string

A prefix to copy names. Defaults to null if not provided.

rename_suffix
string

A suffix to copy names. Defaults to null if not provided and appends a localized string of - Copy based on the ad account locale.

start_time
datetime

The start time of the set, e.g. 2015-03-12 23:59:59-07:00 or 2015-03-12 23:59:59 PDT. UTC UNIX timestamp. If not set, the copied adset will inherit the start time from the original set

status_option
enum {ACTIVE, PAUSED, INHERITED_FROM_SOURCE}
ค่าเริ่มต้น: PAUSED

ACTIVE: the copied adset will have active status. PAUSED: the copied adset will have paused status. INHERITED_FROM_SOURCE: the copied adset will have the status from the original set.

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

This endpoint supports read-after-write and will read the node represented by copied_adset_id in the return type.
Struct {
copied_adset_id: numeric string,
ad_object_ids: List [
Struct {
ad_object_type: enum {unique_adcreative, ad, ad_set, campaign, opportunities, privacy_info_center, topline, ad_account},
source_id: numeric string,
copied_id: numeric string,
}
],
}

Error Codes

ข้อผิดพลาดคำอธิบาย
100Invalid parameter
200Permissions error
613Calls to this api have exceeded the rate limit.

กำลังอัพเดต

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

กำลังลบ

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