图谱 API 版

Ads Pixel Shared Accounts

读取

你无法在此端点执行该操作。

创建

你可以通过下列路径向 shared_accounts 连线发出 POST 请求:
When posting to this edge, no Graph object will be created.

例子

Graph API Explorer
POST /v19.0/{pixel-id}/shared_accounts HTTP/1.1
Host: graph.facebook.com

account_id=%7Bad-account-id%7D&business=%7Bbusiness-id%7D
/* PHP SDK v5.0.0 */
/* make the API call */
try {
  // Returns a `Facebook\FacebookResponse` object
  $response = $fb->post(
    '/{pixel-id}/shared_accounts',
    array (
      'account_id' => '{ad-account-id}',
      'business' => '{business-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(
    "/{pixel-id}/shared_accounts",
    "POST",
    {
        "account_id": "{ad-account-id}",
        "business": "{business-id}"
    },
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);
Bundle params = new Bundle();
params.putString("account_id", "{ad-account-id}");
params.putString("business", "{business-id}");
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/{pixel-id}/shared_accounts",
    params,
    HttpMethod.POST,
    new GraphRequest.Callback() {
        public void onCompleted(GraphResponse response) {
            /* handle the result */
        }
    }
).executeAsync();
NSDictionary *params = @{
  @"account_id": @"{ad-account-id}",
  @"business": @"{business-id}",
};
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                               initWithGraphPath:@"/{pixel-id}/shared_accounts"
                                      parameters:params
                                      HTTPMethod:@"POST"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];
curl -X POST \
  -F 'account_id={ad-account-id}' \
  -F 'business={business-id}' \
  -F 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/v19.0/{pixel-id}/shared_accounts
如果你希望详细了解如何使用图谱 API,请阅读我们的图谱 API 指南

参数

参数描述
account_id
numeric string

SELF_EXPLANATORY

必填
business
numeric string or integer

SELF_EXPLANATORY

必填

返回类型

这个端点支持先写后读,并会读取接收你的 POST 请求的节点。
Struct {
success: bool,
}

错误代码

错误描述
368The action attempted has been deemed abusive or is otherwise disallowed
100Invalid parameter
190Invalid OAuth 2.0 Access Token
200Permissions error

更新

你无法在此端点执行该操作。

删除

你可以向 /{ads_pixel_id}/shared_accounts 发出 DELETE 请求,将 an AdAccount 与 an AdsPixel 取消关联。

参数

参数描述
account_id
numeric string

SELF_EXPLANATORY

必填
business
numeric string or integer

SELF_EXPLANATORY

必填

返回类型

Struct {
success: bool,
}

错误代码

错误描述
100Invalid parameter