Graph API Version

Ad Place Page Set

An ad place page set is a set of locations (local pages) under a main page. Each parent page can be associated to many ad place page sets. Currently, ad place page sets contain all the local pages of a main page. The set of pages in an ad place page set cannot be changed.

Reading

A collection of pages representing physical locations. Used in ads.

Examples

Read an ad place page set by ID:

use FacebookAds\Object\AdPlacePageSet;

$set = new AdPlacePageSet(<PLACE_PAGE_SET_ID>);
$set->read();
from facebookads.adobjects.adplacepageset import AdPlacePageSet

ad_place_page_set = AdPlacePageSet(<AD_PLACE_PAGE_SET_ID>)
ad_place_page_set.remote_read()
curl -G \
  -d 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/v2.11/<PLACE_PAGE_SET_ID>

Read all ad place page sets within an ad account:

use FacebookAds\Object\AdAccount;

$account = new AdAccount('act_<AD_ACCOUNT_ID>');
$sets = $account->getAdPlacePageSets();
from facebookads.adobjects.adaccount import AdAccount

account = AdAccount('act_<AD_ACCOUNT_ID>')
sets = account.get_ad_place_page_sets()
APINodeList<AdPlacePageSet> placePageSets = new AdAccount(act_<AD_ACCOUNT_ID>, context).getAdPlacePageSets()
  .execute();
curl -G \
  -d 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/v2.11/act_<AD_ACCOUNT_ID>/ad_place_page_sets

Example

Graph API Explorer
GET /v4.0/{ad-place-page-set-id} 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-place-page-set-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(
    "/{ad-place-page-set-id}",
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/{ad-place-page-set-id}",
    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-place-page-set-id}"
                                      parameters:params
                                      HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];
If you want to learn how to use the Graph API, read our Using Graph API guide.

Parameters

This endpoint doesn't have any parameters.

Fields

FieldDescription
id
numeric string

ID of the Page set

account_id
numeric string

ID of the payments ad account associated with the Page set

location_types
list<enum>

Type of user location the page set targets (e.g., 'recent', 'home')

name
string

Name of the Page set

pages_count
int32

The number of pages that are contained in the Page set

parent_page

The parent page whose children are contained in the Page set

Validation Rules

ErrorDescription
100Invalid parameter

Creating

Page locations require whitelisting, access can be requested here.

Ad place page sets can only be created for a page (parent page) with at least one location. To find out whether a page has locations this API call can be made:

use FacebookAds\Api;
use FacebookAds\Http\RequestInterface;

$response = Api::instance()->call(
  '/'.<PAGE_ID>.'/locations',
  RequestInterface::METHOD_GET,
  array(
    'limit' => 1,
  ))->getContent();

$has_locations = count($response['data']) > 0;
from facebookads.api import FacebookAdsApi

response = FacebookAdsApi.get_default_api().call(
    'GET',
    ('/{}/locations'.format(<PAGE_ID>),),
    {
        'limit': 1,
    }).json()

has_locations = len(response['data']) > 0
curl -G \
  -d 'limit=1' \
  -d 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/v2.11/<PAGE_ID>/locations

If the response contains at least one object, the main page can be used to create an ad place page set:

use FacebookAds\Object\AdPlacePageSet;
use FacebookAds\Object\Fields\AdPlacePageSetFields;

$set = new AdPlacePageSet(null, 'act_<AD_ACCOUNT_ID>');
$set->setData(array(
  AdPlacePageSetFields::NAME => 'Place Page Set',
  AdPlacePageSetFields::PARENT_PAGE => <PAGE_ID>,
));
$set->create();
from facebookads.adobjects.adplacepageset import AdPlacePageSet

ad_place_page_set = AdPlacePageSet(parent_id='act_<AD_ACCOUNT_ID>')
ad_place_page_set.update({
    AdPlacePageSet.Field.name: 'Ad Place Page Set',
    AdPlacePageSet.Field.parent_page: <PAGE_ID>,
})
ad_place_page_set.remote_create()
curl \
  -F 'name=Place Page Set' \
  -F 'parent_page=<PAGE_ID>' \
  -F 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/v2.11/act_<AD_ACCOUNT_ID>/ad_place_page_sets

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

Parameters

ParameterDescription
location_types
list<enum {recent, home}>

Type of user location the page set targets (e.g., 'recent', 'home')

name
string

Name of The Place PageSet

Required
parent_page
numeric string or integer

The parent page ID for all the locations pages

Required

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
194Missing at least one required parameter

Updating

Examples

use FacebookAds\Object\Fields\AdPlacePageSetFields;
use FacebookAds\Object\AdPlacePageSet;

$set = new AdPlacePageSet(<PLACE_PAGE_SET_ID>);
$set->{AdPlacePageSetFields::NAME} = 'New Place Page Set Name';
$set->update();
from facebookads.adobjects.adplacepageset import AdPlacePageSet

ad_place_page_set = AdPlacePageSet(<AD_PLACE_PAGE_SET_ID>)
ad_place_page_set[AdPlacePageSet.Field.name] = 'New Ad Place Page Set Name'
ad_place_page_set.remote_update()
curl \
  -F 'name=New Place Page Set Name' \
  -F 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/v2.11/<PLACE_PAGE_SET_ID>

You can update an AdPlacePageSet by making a POST request to /{ad_place_page_set_id}.

Parameters

ParameterDescription
name
string

A human readable string to help identify the Page Set.

Return Type

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

Validation Rules

ErrorDescription
100Invalid parameter

Deleting

You can't perform this operation on this endpoint.