Phiên bản API Đồ thị

Ad Account, Assigned Users

Đọc

Business and system users assigned to this Ad Account.

Ví dụ

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
}];
Nếu bạn muốn tìm hiểu cách sử dụng API Đồ thị, hãy đọc Hướng dẫn sử dụng API Đồ thị của chúng tôi.

Thông số

Thông sốMô tả
business
numeric string or integer

The business associated with this Ad Account

Bắt buộc

Trường

Đọc từ cạnh này sẽ trả về một kết quả JSON đã định dạng:

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

data

Danh sách nút AssignedUser.

Các trường sau sẽ được thêm vào mỗi nút trả về:

TrườngMô tả
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

Để biết thêm chi tiết về chia trang, hãy xem hướng dẫn về API Đồ thị.

summary

Thông tin tổng hợp về cạnh, chẳng hạn số lượng. Hãy chỉ định các trường để tìm nạp trong thông số tóm tắt (như summary=total_count).

TrườngMô tả
total_count
unsigned int32

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

Mã lỗi

LỗiMô tả
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.

Tạo

Bạn không thể thực hiện thao tác này trên điểm cuối này.

Cập nhật

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']
Bạn có thể cập nhật an AdAccount bằng cách thực hiện yêu cầu POST đến /act_{ad_account_id}/assigned_users.

Thông số

Thông sốMô tả
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

Bắt buộc

Kiểu trả về

Điểm cuối này hỗ trợ đọc sau khi ghi và sẽ đọc nút mà bạn đã đăng vào đó.
Struct {
success: bool,
}

Mã lỗi

LỗiMô tả
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.

Xóa

Bạn có thể hủy liên kết a User khỏi an AdAccount bằng cách thực hiện yêu cầu DELETE đến /act_{ad_account_id}/assigned_users.

Thông số

Thông sốMô tả
user
UID

Business user id or system user id

Bắt buộc

Kiểu trả về

Struct {
success: bool,
}

Mã lỗi

LỗiMô tả
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