CARVIEW |

Page Locations
This represents different page locations of a parent business Page. For example, pages for each restaurant in a chain of restaurants.
Reading this edge is available to all apps. Some types of publishing operations are only available to select developers.
When using the publishing operations of this API please follow these guidelines:
- Don't charge a fee for creating or claiming a Page.
- Before enabling clients to create a Page, you must first provide a means for them to claim an existing Place to prevent Page duplication.
- Ensure that you only create Pages associated with a real physical address, not fake or virtual Places.
- If you create a Page on a client's behalf, you must transfer full administration of that Page upon the client's request.
- Don't disclose administrators of a Page to third parties without the client's consent, except as required by any applicable law, by any rule or regulation of any court or government agency of competent jurisdiction, or pursuant to legal process.
Reading
GET /v23.0/{page-id}/locations 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(
'/{page-id}/locations',
'{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(
"/{page-id}/locations",
function (response) {
if (response && !response.error) {
/* handle the result */
}
}
);
/* make the API call */
new GraphRequest(
AccessToken.getCurrentAccessToken(),
"/{page-id}/locations",
null,
HttpMethod.GET,
new GraphRequest.Callback() {
public void onCompleted(GraphResponse response) {
/* handle the result */
}
}
).executeAsync();
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
initWithGraphPath:@"/{page-id}/locations"
parameters:params
HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
id result,
NSError *error) {
// Handle the result
}];
Permissions
- Any valid access token is required to retrieve locations.
Fields
An array of Page objects, each representing an individual location for the business.
Publishing
You can add an existing location-based Page to this list by publishing on this edge:
POST /v23.0/{page-id}/locations HTTP/1.1
Host: graph.facebook.com
main_page_id=%7Bpage-id%7D&store_number=12345&location_page_id=%7Bsubpage-id%7D
/* PHP SDK v5.0.0 */
/* make the API call */
try {
// Returns a `Facebook\FacebookResponse` object
$response = $fb->post(
'/{page-id}/locations',
array (
'main_page_id' => '{page-id}',
'store_number' => '12345',
'location_page_id' => '{subpage-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(
"/{page-id}/locations",
"POST",
{
"main_page_id": "{page-id}",
"store_number": "12345",
"location_page_id": "{subpage-id}"
},
function (response) {
if (response && !response.error) {
/* handle the result */
}
}
);
Bundle params = new Bundle();
params.putString("main_page_id", "{page-id}");
params.putString("store_number", "12345");
params.putString("location_page_id", "{subpage-id}");
/* make the API call */
new GraphRequest(
AccessToken.getCurrentAccessToken(),
"/{page-id}/locations",
params,
HttpMethod.POST,
new GraphRequest.Callback() {
public void onCompleted(GraphResponse response) {
/* handle the result */
}
}
).executeAsync();
NSDictionary *params = @{
@"main_page_id": @"{page-id}",
@"store_number": @"12345",
@"location_page_id": @"{subpage-id}",
};
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
initWithGraphPath:@"/{page-id}/locations"
parameters:params
HTTPMethod:@"POST"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
id result,
NSError *error) {
// Handle the result
}];
Permissions
- A page access token is required to publish existing locations to a page.
- A page access token is required to create new locations and add them to a page. Only selected developers will have access to this functionality.
Fields
Name | Description | Type |
---|---|---|
| To be used when |
|
| Defines the opening hours for this location. |
|
| Defines a single opening hours range for a day. Each day can have 2 different hours ranges. |
|
| Whether to disable any warnings (not errors) that result from this API call, such as latitude and longitude not matching street address. |
|
| Is this a franchise location? |
|
| Name of a country. If |
|
| Name of a city. If |
|
| ID of a city. This is the |
|
| Decimal based latitude. This is required for |
|
| This defines the location for this page. This is required if |
|
| Decimal based longitude. This is required for |
|
| Name of a state (or local equivalent). |
|
| Street address. This is required for |
|
| Zip code of location (or local equivalent). |
|
| The ID of the Facebook Page you would like to add as a location. If this field is not included, you must instead specify |
|
| The ID for the Facebook Page that is the parent of all the locations. This is a required field. |
|
| Is this location permanently closed? |
|
| Phone number for this location. This is required if |
|
| A list of pickup options available at this location. |
|
| Place topics for this location. This is required if |
|
| An arbitrary, developer-defined ID for this location, usually used to link back to an internal database of locations. This is a required field. |
|
| Indicates how the business corresponding to a Page is operating differently than usual. If set to | enum { |
Response
Upon success, your app receives the following:
{ "success": true }
Otherwise a relevant error message will be returned.
Deleting
You can remove a location page from a parent's list of locations by deleting on this edge:
DELETE /v23.0/{page-id}/locations HTTP/1.1
Host: graph.facebook.com
main_page_id=%7Bpage-id%7D&store_number=12345&location_page_id=%7Bsubpage-id%7D
/* PHP SDK v5.0.0 */
/* make the API call */
try {
// Returns a `Facebook\FacebookResponse` object
$response = $fb->delete(
'/{page-id}/locations',
array (
'main_page_id' => '{page-id}',
'store_number' => '12345',
'location_page_id' => '{subpage-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(
"/{page-id}/locations",
"DELETE",
{
"main_page_id": "{page-id}",
"store_number": "12345",
"location_page_id": "{subpage-id}"
},
function (response) {
if (response && !response.error) {
/* handle the result */
}
}
);
Bundle params = new Bundle();
params.putString("main_page_id", "{page-id}");
params.putString("store_number", "12345");
params.putString("location_page_id", "{subpage-id}");
/* make the API call */
new GraphRequest(
AccessToken.getCurrentAccessToken(),
"/{page-id}/locations",
params,
HttpMethod.DELETE,
new GraphRequest.Callback() {
public void onCompleted(GraphResponse response) {
/* handle the result */
}
}
).executeAsync();
NSDictionary *params = @{
@"main_page_id": @"{page-id}",
@"store_number": @"12345",
@"location_page_id": @"{subpage-id}",
};
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
initWithGraphPath:@"/{page-id}/locations"
parameters:params
HTTPMethod:@"DELETE"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
id result,
NSError *error) {
// Handle the result
}];
Permissions
- A page access token is required to remove locations from a parent page.
Fields
All fields are required.
Name | Description | Type |
---|---|---|
| ID of the main Facebook Page for this location. |
|
| Developer-defined ID for this location. |
|
| Facebook-defined ID for this location. |
|
Response
If successful:
{ "success": true }
Otherwise a relevant error message will be returned.
Updating
This endpoint is supported for New Page Experience.
POST /v23.0/{page-id}/locations HTTP/1.1
Host: graph.facebook.com
main_page_id=%7Bpage-id%7D&store_number=12345&location_page_id=%7Bsubpage-id%7D
/* PHP SDK v5.0.0 */
/* make the API call */
try {
// Returns a `Facebook\FacebookResponse` object
$response = $fb->post(
'/{page-id}/locations',
array (
'main_page_id' => '{page-id}',
'store_number' => '12345',
'location_page_id' => '{subpage-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(
"/{page-id}/locations",
"POST",
{
"main_page_id": "{page-id}",
"store_number": "12345",
"location_page_id": "{subpage-id}"
},
function (response) {
if (response && !response.error) {
/* handle the result */
}
}
);
Bundle params = new Bundle();
params.putString("main_page_id", "{page-id}");
params.putString("store_number", "12345");
params.putString("location_page_id", "{subpage-id}");
/* make the API call */
new GraphRequest(
AccessToken.getCurrentAccessToken(),
"/{page-id}/locations",
params,
HttpMethod.POST,
new GraphRequest.Callback() {
public void onCompleted(GraphResponse response) {
/* handle the result */
}
}
).executeAsync();
NSDictionary *params = @{
@"main_page_id": @"{page-id}",
@"store_number": @"12345",
@"location_page_id": @"{subpage-id}",
};
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
initWithGraphPath:@"/{page-id}/locations"
parameters:params
HTTPMethod:@"POST"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
id result,
NSError *error) {
// Handle the result
}];
Permissions
- A page access token is required to update locations on a parent page.
Fields
To update, include any of the required publishing fields, and any of the other publishing fields that you want to change values for.
Response
If successful:
{ "success": true }
Otherwise a relevant error message will be returned.