这代表父商家公共主页的不同公共主页地点。例如,连锁餐厅中每家餐厅的公共主页。
所有应用都可以读取此连线。某些类型的发布操作仅适用于特定开发者。
使用此 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 }
否则系统会返回相关的错误消息。