Graph API 版本

Ad Account, Assigned Users

閱讀中

Business and system users assigned to this Ad Account.

例子

Graph API Explorer
GET /v19.0/{ad-account-id}/assigned_users 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-account-id}/assigned_users',
    '{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-account-id}/assigned_users",
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/{ad-account-id}/assigned_users",
    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-account-id}/assigned_users"
                                      parameters:params
                                      HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];
如果想了解如何使用 Graph API,請參閱我們的使用 Graph API 指南

參數

參數描述
business
numeric string or integer

The business associated with this Ad Account

必填

欄位

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

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

data

AssignedUser 節點的清單。

將在每個傳回的節點新增以下欄位:

欄位說明
permitted_tasks
list<string>

Tasks that are assignable on this object

tasks
list<string>

All unpacked roles/tasks of this particular user on this object

paging

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

summary

與關係連線相關的彙總資訊,例如次數等。請在摘要參數中指定要擷取的欄位(例如 summary=total_count)。

欄位說明
total_count
unsigned int32

Total number of business and system users assigned to this Ad Account

Error Codes

錯誤說明
100Invalid parameter
190Invalid OAuth 2.0 Access Token
368The action attempted has been deemed abusive or is otherwise disallowed
2635You are calling a deprecated version of the Ads API. Please update to the latest version.
200Permissions error
80004There have been too many calls to this ad-account. Wait a bit and try again. For more info, please refer to https://developers.facebook.com/docs/graph-api/overview/rate-limiting#ads-management.

建立中

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

更新中

In v3.1 we introduce the new concept of task-based permissions to substitute for the current role-based permission. This affects access to ad accounts managed by Business Manager API and Pages. Role-based access to ad accounts and Pages is still available but will be deprecated in the future. This impacts the following roles and provides the equivalent tasks for ad accounts:

  • Role: ADMIN, Tasks: ['MANAGE', 'ADVERTISE', 'ANALYZE' - Manage all aspects of ad campaigns, reporting, billing and ad account permissions.
  • Role: GENERAL_USER, Tasks: ['ADVERTISE', 'ANALYZE'] - Create ads using the funding source associated with the ad account. Run reports.
  • Role: GENERAL_USER, Tasks: ['ANALYZE'] - Run reports.

This replaces the following roles in Business Manager API with these tasks:

  • Role: MANAGER, Tasks: ['MANAGE', 'CREATE_CONTENT', 'MODERATE', 'ADVERTISE', 'ANALYZE', 'DRAFT']
  • Role: CONTENT_CREATOR, Tasks: ['CREATE_CONTENT', 'MODERATE', 'ADVERTISE', 'ANALYZE', 'DRAFT']
  • Role: MODERATOR, Tasks: ['MODERATE', 'ADVERTISE', 'ANALYZE', 'DRAFT']
  • Role: ADVERTISER, Tasks: ['ADVERTISE', 'ANALYZE', 'DRAFT']
  • Role: INSIGHTS_ANALYST, Tasks: ['ANALYZE', 'DRAFT']
  • Role: CREATIVE_HUB_MOCKUPS_MANAGER, Tasks: ['DRAFT']
You can update an AdAccount by making a POST request to /act_{ad_account_id}/assigned_users.

參數

參數描述
tasks
array<enum {MANAGE, ADVERTISE, ANALYZE, DRAFT, AA_ANALYZE}>

AdAccount permission tasks to assign this user

user
UID

Business user id or system user id

必填

傳回類型

This endpoint supports 寫入後讀取 and will read the node to which you POSTed.
Struct {
success: bool,
}

Error Codes

錯誤說明
100Invalid parameter
200Permissions error
368The action attempted has been deemed abusive or is otherwise disallowed
2620Invalid call to update account permissions
190Invalid OAuth 2.0 Access Token
2635You are calling a deprecated version of the Ads API. Please update to the latest version.

正在刪除

You can dissociate a User from an AdAccount by making a DELETE request to /act_{ad_account_id}/assigned_users.

參數

參數描述
user
UID

Business user id or system user id

必填

傳回類型

Struct {
success: bool,
}

Error Codes

錯誤說明
3919There was an unexpected technical issue. Please try again.
368The action attempted has been deemed abusive or is otherwise disallowed
100Invalid parameter
457The session has an invalid origin
190Invalid OAuth 2.0 Access Token