Marketing API Version

Ad Account Adrules Library

Reading

The ad library rules associated with this ad account

Graph API Explorer
GET /v2.10/{ad-account-id}/adrules_library HTTP/1.1
Host: graph.facebook.com
/* PHP SDK v5.0.0 */
/* make the API call */
$request = new FacebookRequest(
  $session,
  'GET',
  '/{ad-account-id}/adrules_library'
);
$response = $request->execute();
$graphObject = $response->getGraphObject();
/* handle the result */
/* make the API call */
FB.api(
    "/{ad-account-id}/adrules_library",
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/{ad-account-id}/adrules_library",
    null,
    HttpMethod.GET,
    new GraphRequest.Callback() {
        public void onCompleted(GraphResponse response) {
            /* handle the result */
        }
    }
).executeAsync();
// For more complex open graph stories, use `FBSDKShareAPI`
// with `FBSDKShareOpenGraphContent`
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                               initWithGraphPath:@"/{ad-account-id}/adrules_library"
                                      parameters:params
                                      HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];

Permissions

Developers usually request these permissions for this endpoint:

Marketing Apps
  • ads_management
Page management Apps
No data
Other Apps
No data

Parameters

This endpoint doesn't have any parameters.

Fields

Reading from this edge will return a JSON formatted result:

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

data

A list of AdRule nodes.

paging

For more details about pagination, see the Graph API guide.

Validation Rules

ErrorDescription
100Invalid parameter
200Permissions error
274The ad account is not enabled for usage in Ads API. Please add it in developers.facebook.com/apps -> select your app -> settings -> advanced -> advertising accounts -> Ads API

Creating

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

Parameters

NameDescription
account_id
numeric string

Ad Account ID. This is inferred from the path.

evaluation_spec
Object

Defines the evaluation spec upon which a rule will be executed

evaluation_type
enum{SCHEDULE, TRIGGER}
Required
filters
list<Object>
Required
field
string
Required
value
numeric, string, boolean, list<>, or object-like arrays
Required
operator
enum{GREATER_THAN, LESS_THAN, EQUAL, NOT_EQUAL, IN_RANGE, NOT_IN_RANGE, IN, NOT_IN, CONTAIN, NOT_CONTAIN, ANY, ALL, NONE}
Required
trigger
Object
type
enum{STATS_MILESTONE, STATS_CHANGE}
Required
field
string
value
numeric, string, boolean, list<>, or object-like arrays
operator
enum{GREATER_THAN, LESS_THAN, EQUAL, NOT_EQUAL, IN_RANGE, NOT_IN_RANGE, IN, NOT_IN, CONTAIN, NOT_CONTAIN, ANY, ALL, NONE}
execution_spec
Object

Defines the execution spec upon which a rule will be executed

execution_type
enum{PING_ENDPOINT, NOTIFICATION, PAUSE, CHANGE_BUDGET, CHANGE_BID, ROTATE, MESSENGER_BOT}
Required
execution_options
list<Object>
field
string
Required
value
numeric, string, boolean, list<>, or object-like arrays
Required
operator
enum{EQUAL, IN}
Required
name
string

The friendly name of a rule, optional for inline rules

Required
schedule_spec
Object

Specifies the schedule with which a rule will be evaluated

schedule_type
enum{DAILY, HOURLY, SEMI_HOURLY}
Required
status
enum {ENABLED, DISABLED, DELETED}

The status of a rule

Return Type

This endpoint supports read-after-write and will read the node represented by id in the return type.
Struct {
id: numeric string,
}

Validation Rules

ErrorDescription
100Invalid parameter
200Permissions error
2633This shared login is disabled. Go to Ads Manager for more information.

Updating

You can't perform this operation on this endpoint.

Deleting

You can't perform this operation on this endpoint.