Marketing 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
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 are contained in the Page set

parent_page

The parent page whose children are contained in the Page set

Edges

No edges

Validation Rules

ErrorDescription
100Invalid parameter
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

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

Example

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

NameDescription
location_types
list<enum {recent, home}>

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

name
string

Ad place page set name

Required
parent_page
numeric string or integer

The parent page ID

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,
}

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>

Example

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

Parameters

NameDescription
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,
}

Deleting

You can't perform this operation on this endpoint.