這代表主要商家粉絲專頁的不同粉絲專頁地點。例如,連鎖餐廳旗下每家餐廳的粉絲專頁。
所有應用程式皆可讀取此關係連線。某些類型的發佈操作僅供特定開發人員使用。
使用此 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 粉絲專頁編號為所有分店地點的主要粉絲專頁。此為必要欄位。 |
|
| 此分店地點是否永久關閉? |
|
| 此分店地點的電話號碼。若未指定 |
|
| 此分店地點可用的自取選項清單。 |
|
| 放置此分店地點的主題。若未指定 |
|
| 此分店地點的開發人員定義任意編號,通常用於連結回分店地點的內部資料庫。此為必要欄位。 |
|
| 指出對應於粉絲專頁的商家營業方式如何異於平常。若設為 | enum { |
成功時,應用程式會收到下列回應:
{ "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 }
否則會傳回相關錯誤訊息。