Represents a location.
Get information about a location.
The Page Public Content Access feature is required to scrape the LocationNode data of public pages.
curl -i -X GET \
"https://graph.facebook.com/{graph-api-version}/{location-id}&access_token={user-access-token}"{
"name": "{city}, {state}",
"id": "{location-id}"
}The user_location permission is required.
curl -i -X GET \
"https://graph.facebook.com/{graph-api-version}/{user-id}?
fields=location{location{city,state,region_id}}&access_token={user-access-token}"{
"location": {
"location": {
"city": "San Jose",
"state": "CA",
"region_id": 3847
},
"id": "111948542155151" //location-id
},
"id": "{user-id}"
}The manage_pages permission is required.
curl -i -X GET \
"https://graph.facebook.com/{graph-api-version}/{page-id}?fields=location&access_token={page-access-token}"{
"location": {
"city": "Menlo Park",
"country": "United States",
"latitude": 37.4786342,
"located_in": "166793820034304",
"longitude": -122.163581,
"state": "CA",
"street": "1 Hacker Way",
"zip": "94025"
},
"id": "{page-id}"
}GET v24.0/...?fields={fieldname_of_type_Location} 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(
'...?fields={fieldname_of_type_Location}',
'{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(
"...?fields={fieldname_of_type_Location}",
function (response) {
if (response && !response.error) {
/* handle the result */
}
}
);/* make the API call */
new GraphRequest(
AccessToken.getCurrentAccessToken(),
"...?fields={fieldname_of_type_Location}",
null,
HttpMethod.GET,
new GraphRequest.Callback() {
public void onCompleted(GraphResponse response) {
/* handle the result */
}
}
).executeAsync();/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
initWithGraphPath:@"...?fields={fieldname_of_type_Location}"
parameters:params
HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
id result,
NSError *error) {
// Handle the result
}];| Field | Description |
|---|---|
citystring | City |
city_idunsigned int32 | City ID. Any city identified is also a city you can use for targeting ads. |
countrystring | Country |
country_codestring | Country code |
latitudefloat | Latitude |
located_inid | The parent location if this location is located within another location |
longitudefloat | Longitude |
namestring | Name |
regionstring | Region |
region_idunsigned int32 | Region ID. Specifies a geographic region, such as California. An identified region is the same as one you can use to target ads. |
statestring | State |
streetstring | Street |
zipstring | Zip code |
locations edge from the following paths: | Parameter | Description |
|---|---|
boolean | Indicates whether this location is always open |
delivery_and_pickup_option_infoarray<string> | Specify upto 3 delivery/pickup URLs |
differently_open_offeringsJSON object {enum {ONLINE_SERVICES, DELIVERY, PICKUP, OTHER} : boolean} | A mapping of potential business offerings to true / false. Intended to be used / displayed when temporary_status = "differently_open" in order to express that the business is still operating in this capacity, such as a restaurant offering takeout. |
hoursdictionary { string : <> } | Hours for this store. Please see the format for hours in our page documentation for examples |
ignore_warningsboolean | Whether to disable any warnings (not errors) that result from this API call, such as |
locationObject | This defines the location for this page. This is required if the Page referenced by the |
location_page_idnumeric string | The ID of the Facebook Page you would like to add or update as a location |
old_store_numberint64 | Old store number. Used when you want to change the store number for a location |
page_usernamestring | Vanity URL for this location. This has to be an unused vanity URL. You should check by querying |
permanently_closedboolean | Is this location permanently closed? |
phonestring | Phone number for this location. This is required if the Page referenced by the |
pickup_optionsarray<enum {CURBSIDE, IN_STORE, OTHER}> | List of pickup options available at this Page's store location |
place_topicslist<numeric string> | Place topics for this location. This is required if the Page referenced by the |
string | Price range of the business, such as a restaurant or salon. Values can be one of |
recommendation_actionenum {ACCEPT_NEW, ACCEPT_CLOSED, REJECT_NEW, REJECT_CLOSED} | recommendation_action |
recommendation_dsstring | recommendation_ds |
recommendation_store_idint64 | recommendation_store_id |
store_codestring | The store code. An arbitrary, alphanumeric, developer-defined ID for this location, usually used to link back to an internal database of locations |
store_location_descriptorstring | Location descriptor for this store. This will appear after the Page name and should only be used if the location has a special location that's not clear from its city or street address. e.g. if it's inside a shopping mall or if it's best identified by its neighborhood |
store_namestring | The store name |
store_numberint64 | An arbitrary, developer-defined ID for this location, usually used to link back to an internal database of locations Required |
temporary_statusenum {DIFFERENTLY_OPEN, TEMPORARILY_CLOSED, OPERATING_AS_USUAL, NO_DATA} | Indicates whether the business corresponding to this Page is temporarily closed or operating in a different-than-usual capacity |
typestring | store recommendation type for logging purpose |
URI | The URL of the location's website |
id in the return type.id: numeric string, | Error | Description |
|---|---|
| 371 | Invalid Page location update |
| 368 | The action attempted has been deemed abusive or is otherwise disallowed |
| 100 | Invalid parameter |
| 200 | Permissions error |
| 102 | Session key invalid or no longer valid |
| 80001 | There have been too many calls to this Page account. Wait a bit and try again. For more info, please refer to https://developers.facebook.com/docs/graph-api/overview/rate-limiting. |
| 160 | Invalid geolocation type |
| 190 | Invalid OAuth 2.0 Access Token |