グラフAPIバージョン

ページの所在地

これは、親ビジネスページの別のページの所在地を表します。例えば、レストランチェーンの各店舗のページです。

すべてのアプリがこのエッジを読み取ることができます。公開操作の一部のタイプは、厳選された開発者のみが使用可能です。

このAPIの公開操作を使用する際は、次のガイドラインに従ってください。

  • ページの作成や取得で、料金を請求しないでください。
  • クライアントがページを作成できるようにする前に、まず既存の場所を取得する手段を提供し、ページの重複を防ぐ必要があります。
  • 実際に存在する住所に関連したページだけを作成するようにし、架空もしくは仮想の場所に関連したページは作成しないようにしてください。
  • クライアントに代わってページを作成する場合は、クライアントのリクエストに応じてそのページのすべての管理を移譲する必要があります。
  • ページの管理者の情報を、クライアントの同意なしに第三者に公開しないでください。ただし、適用される法律、裁判所または管轄地域の政府機関の規則や規定、法的手続きに従う場合は除きます。

読み取り

グラフAPIエクスプローラ
GET /v19.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 /v19.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
}];

アクセス許可

  • 既存の所在地をページに公開するには、ページアクセストークンが必要です。
  • 新規所在地を作成しページに追加するには、ページアクセストークンが必要です。この機能にアクセスできるのは、一部の開発者だけです。

フィールド

名前説明

differently_open_offerings

temporary_statusdifferently_openに設定されている場合に、事業者が通常とは異なるどのような営業をしているかを示すために使用します(例: レストランがテイクアウトを提供している場合)。ONLINE_SERVICESDELIVERYPICKUPOTHERのうち1つ以上を列挙型キーとして指定できます。それぞれの値をtrueまたはfalseに設定します。例えば、レストランが料理のテイクアウトを提供しているが配達を停止している場合は、differently_open_offerings:{"DELIVERY":"false", "PICKUP":"true"}を設定します。

object

hours

この位置情報の営業時間を定義します。

object

{day}_{number}_{status}

その日の営業時間帯の1つを定義します。1日ごとに、2つの異なる営業時間を定義できます。{day}は曜日の最初の3文字で、{number}はそれぞれの日の2種類の営業時間のいずれかを表す1または2です。{status}openまたはcloseのいずれかで、営業時間の開始時間または終了時間を表します。例えば、mon_1_openの値を17:00に設定し、mon_1_closeの値を21:15に設定した場合、営業時間の1つが月曜日の午後5時から午後9時15分までであることを表します。

string

ignore_warnings

このAPI呼び出しに起因する(緯度と経度が住所と一致しないなどの)警告(エラーではない)をオフにするかどうか。

bool

is_franchise

フランチャイズの位置情報かどうか。

bool

country

国の名前。city_idを指定しない場合は必須です。

string

city

市区町村の名前。city_idを指定しない場合は必須です。

string

city_id

市区町村のID。これは、adcityターゲット設定オプションkey値です。このフィールドを指定しない場合は、cityおよびcountryが必須です(米国の位置情報については、stateおよびzipも必須です)。

int

latitude

固定小数点数ベースの緯度。locationでは必須です。

string

location

このページの位置情報を定義します。location_page_idを指定しない場合は必須です。ディクショナリーに主要なstreet(町名・番地)が含まれている必要があります。また、city_idが含まれているか、citystatecountryのすべてが含まれている必要があります(ただし、米国以外の住所では、stateは任意です)。米国以外の住所では、zipフィールドも任意です。市区町村IDの生成については、このドキュメントの後半をご覧ください。

object

longitude

固定小数点数ベースの経度。locationでは必須です。

string

state

州の名前(または地元の同等のもの)。

string

street

番地。locationでは必須です。

string

zip

位置情報の郵便番号(または地元の同等のもの)。

string

location_page_id

位置情報として追加したいFacebookページのID。このフィールドを指定しない場合は、代わりにlocationplace_topicsphoneフィールドを指定して、新しい位置情報ページを作成する必要があります。

numeric string

main_page_id

すべての位置情報の親であるFacebookページのID。これは必須フィールドです。

numeric string

permanently_closed

この位置情報は完全に閉店しているかどうか。

bool

phone

この位置情報の電話番号。location_page_idを指定しない場合は必須です。

string

pickup_options

この位置情報で利用できる受け取りオプションのリスト。

enum[] {CURBSIDE, IN_STORE, OTHER}

place_topics

この位置情報の場所のトピック。location_page_idを指定しない場合は必須です。

int[]

store_number

この位置情報の、任意の、開発者定義ID。通常は、位置情報の内部データベースに戻るリンクとして使用されます。これは必須フィールドです。

int

temporary_status

このページに対応する事業者が、どのような通常とは異なる営業をしているかを示します。differently_openに設定した場合は、differently_open_offeringsとともに使用してステータスを設定します。

enum {differently_open, temporarily_closed, operating_as_usual, no_data}

応答

成功すると、アプリは次のものを受け取ります。

{
  "success": true
}

成功しなかった場合は、関連するエラーメッセージが返されます。

削除

このエッジで削除することにより所在地ページを親の所在地のリストから削除できます。

DELETE /v19.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
}];

アクセス許可

  • 親ページから所在地を削除するには、ページアクセストークンが必要です。

フィールド

すべてのフィールドが必須です。

名前 説明

main_page_id

この位置情報のメインのFacebookページのID。

numeric string

store_number

この位置情報の開発者定義のID。

numeric string

location_page_id

この位置情報のFacebook定義のID。

numeric string

応答

成功した場合は、次のようになります。

{
  "success": true
}

成功しなかった場合は、関連するエラーメッセージが返されます。

更新

このエンドポイントは、新しいページエクスペリエンスでサポートされています。

POST /v19.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
}

成功しなかった場合は、関連するエラーメッセージが返されます。