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:
GET /v21.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
}];
An array of Page objects, each representing an individual location for the business.
You can add an existing location-based Page to this list by publishing on this edge:
POST /v21.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
}];
Name | Description | Type |
---|---|---|
| To be used when |
|
| Defines the opening hours for this location. |
|
| 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 |
|
| 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 { |
Upon success, your app receives the following:
{ "success": true }
Otherwise a relevant error message will be returned.
You can remove a location page from a parent's list of locations by deleting on this edge:
DELETE /v21.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
}];
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. |
|
If successful:
{ "success": true }
Otherwise a relevant error message will be returned.
This endpoint is supported for New Page Experience.
POST /v21.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
}];
To update, include any of the required publishing fields, and any of the other publishing fields that you want to change values for.
If successful:
{ "success": true }
Otherwise a relevant error message will be returned.