這代表母企業專頁的不同專頁地點。例如,連鎖餐廳的每間餐廳分店專頁。
所有應用程式都可以讀取此關係連線。某些類型的發佈操作僅適用於特定開發人員。
使用此 API 的發佈操作時,請遵循以下守則:
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
}];
專頁物件陣列,其中每個物件分別代表企業的一個地點。
您可以在此關係連線上發佈地點,從而將按地點建立的現有專頁加到此名單中:
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
}];
名稱 | 說明 | 類型 |
---|---|---|
| 在 |
|
| 定義此地點的營業時間。 |
|
| 指定是否停用此 API 調用產生的任何警告(並非錯誤),例如緯度和經度與街道地址不符。 |
|
| 這是否為特許經營地點? |
|
| 國家/地區名稱。如果未包含 |
|
| 您要新增為地點的 Facebook 專頁編號。如果未包含此欄位,則必須另外指定 |
|
| 所有地點的母地點 Facebook 專頁編號。此為必要欄位。 |
|
| 此地點是否已永久關閉? |
|
| 此地點的電話號碼。如果未指定 |
|
| 適用於此地點的自取選項清單。 |
|
| 此地點的地點主題。如果未指定 |
|
| 開發人員為此地點定義的可變編號,通常用於連結回地點的內部資料庫。此為必要欄位。 |
|
| 標示專頁相應企業的營運方式與平常有何不同。如果此欄位設定為 | 列舉 { |
成功後,應用程式會收到以下內容:
{ "success": true }
否則系統會傳回相關的錯誤訊息。
您可以刪除此關係連線,從地點的母清單中移除地點專頁:
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
}];
所有欄位均為必填欄位。
名稱 | 說明 | 類型 |
---|---|---|
| 此地點的主 Facebook 專頁編號。 |
|
| 開發人員為此地點定義的編號。 |
|
| Facebook 為此地點定義的編號。 |
|
如果成功:
{ "success": true }
否則系統會傳回相關的錯誤訊息。
新版專頁體驗支援此端點。
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
}];
如要更新,請加入任何必填發佈欄位,以及您要更改其值的任何其他發佈欄位。
如果成功:
{ "success": true }
否則系統會傳回相關的錯誤訊息。