API Graph versión

Ad Account, Assigned Users

Lectura

Business and system users assigned to this Ad Account.

Ejemplo

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
}];
Si quieres obtener información sobre cómo usar la API Graph, lee nuestra guía de uso de la API Graph.

Parámetros

ParámetroDescripción
business
numeric string or integer

The business associated with this Ad Account

Obligatorio

Campos

La lectura de este perímetro mostrará un resultado con formato JSON:

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

data

Una lista de nodos AssignedUser.

Los siguientes campos se agregarán a cada nodo devuelto:

CampoDescripción
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

Para obtener más detalles sobre la paginación, consulta la guía de la API Graph.

summary

Información total sobre el perímetro, por ejemplo, los recuentos. Especifica los campos que quieres recuperar en el parámetro "summary" (como en summary=total_count).

CampoDescripción
total_count
unsigned int32

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

Error Codes

ErrorDescripción
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.

Creación

No puedes realizar esta operación en este extremo.

Actualizando

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.

Parámetros

ParámetroDescripción
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

Obligatorio

Return Type

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

Error Codes

ErrorDescripción
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.

Eliminando

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

Parámetros

ParámetroDescripción
user
UID

Business user id or system user id

Obligatorio

Return Type

Struct {
success: bool,
}

Error Codes

ErrorDescripción
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