그래프 API 버전

Product Catalog Hotels

Hotels in a catalog used in Dynamic Ads for Travel. See Dynamic Ads for Travel, Catalog Setup.

When you use this, you can provide Batch Requests to combine a number of API calls into one HTTP request.

For example, to get the total number of hotels in a catalog:

curl -G \
-d "summary=total_count" \
-d "access_token=<ACCESS_TOKEN>" \
https://graph.facebook.com/<API_VERSION>/<PRODUCT_CATALOG_ID>/hotels

To fetch hotels whose name contains "suites":

curl -G \
-d 'fields=["hotel_id","name"]' \
-d 'filter={"name":{"i_contains":"suites"}}' \
-d 'access_token=<ACCESS_TOKEN>'
https://graph.facebook.com/<API_VERSION>/<PRODUCT_CATALOG_ID>/hotels

읽기

Endpoint that returns the hotels from a catalog

Graph API Explorer
GET /v19.0/{product-catalog-id}/hotels 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(
    '/{product-catalog-id}/hotels',
    '{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(
    "/{product-catalog-id}/hotels",
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/{product-catalog-id}/hotels",
    null,
    HttpMethod.GET,
    new GraphRequest.Callback() {
        public void onCompleted(GraphResponse response) {
            /* handle the result */
        }
    }
).executeAsync();
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                               initWithGraphPath:@"/{product-catalog-id}/hotels"
                                      parameters:params
                                      HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];
그래프 API를 사용하는 방법을 알아보려면 그래프 API 사용 가이드를 읽어보세요.

매개변수

매개변수설명
bulk_pagination
boolean

Used for iterating over the edge in large chunks

filter
A JSON-encoded rule

JSON-encoded WCA rule expression representing the filter to be applied for the edge

필드

이 에지로부터 읽는 경우 JSON 형식의 결과를 반환합니다:

{ "data": [], "paging": {}, "summary": {} }

data

Hotel 노드 리스트.

paging

페이지 매김에 대한 자세한 정보는 그래프 API 가이드를 확인하세요.

summary

수치 등 에지에 관해 집계된 정보입니다. 요약 매개변수에 가져오려면 해당 필드를 지정하세요(예: summary=total_count).

필드설명
total_count
unsigned int32

Total number of hotels returned by the query

오류 코드

오류설명
368The action attempted has been deemed abusive or is otherwise disallowed
100Invalid parameter
2500Error parsing graph query

만들기

Example

Example to create a hotel:

curl \
-X POST \
-F "hotel_id=h_157" \
-F "name=Sample Hotel" \
-F "images= [ \
  {'image_url':'http://www.example.com/pic1.jpg', 'tags':['front view']}, \
  {'image_url':'http://www.example.com/pic2.jpg', 'tags':['lobby view']} \
]" \
-F "url=http://www.example.com/samplehotel" \
-F "address={ \
  street_address:'1 Hacker Way', \
  city:'Menlo Park', \
  region:'California', \
  country:'United States', \
  postal_code:'94025', \
  neighborhoods:['Palo Alto','Menlo Park'], \
  latitude:37.484116, \
  longitude:-122.148244 \
}" \
-F "brand=hotel brand" \
-F "description=hotel description" \
-F "guest_ratings= [ \
  {'score':7.8, 'rating_system':'sample_rating', 'number_of_raters':780} \
]" \
-F "star_rating=4" \
-F "loyalty_program=Sample rewards club" \
-F "phone=+351234123456" \
-F "access_token=<ACCESS_TOKEN>" \
https://graph.facebook.com/<API_VERSION>/<PRODUCT_CATALOG_ID>/hotels

다음 경로에서 hotels 에지에 POST 요청을 만들 수 있습니다:
이 에지에 게시할 때 a Hotel이(가) 생성됩니다.

매개변수

매개변수설명
address
Object

The address of the hotel

필수
city
string

필수
city_id
string

country
string

필수
latitude
float

필수
longitude
float

필수
neighborhoods
list<string>

postal_code
string

region
string

필수
street_address
string

필수
applinks
Object

App links for native platforms, e.g. Android, IOS and Windows Phone.

web

android

ios

ipad

iphone

windows_phone

base_price
int64

The base price of the hotel

brand
string

Hotel brand

currency
ISO 4217 Currency Code
기본 값: USD

The currency for base_price, e.g. USD

description
string

Description of the hotel

필수
guest_ratings
list<Object>

Guest ratings for this hotel.

score
float

필수
max_score
int64

필수
rating_system
string

필수
number_of_raters
int64

필수
hotel_id
string

A unique identifier for this hotel provided by advertiser. (i.e. from the id field in the feed

images
list<Object>

Links to hotel images. Please note that carousel format utilizes a square 1:1 aspect ratio images (recommended size - 600x600px) while single hotel ad uses 1.91:1 aspect ratio image(recommended size - 1200x630px). Please provide at least one image.

필수
image_url
URL

필수
tags
list<string>

name
string

Name of the hotel

필수
phone
phone number string

Hotel's phone number

star_rating
float

The star rating of the hotel

url
URL

Link to the external site where you can book a hotel room

필수

반환 유형

이 엔드포인트는 기록 후 읽기를 지원하며 반환 유형에서 id로 표시되는 노드를 읽습니다.
Struct {
id: numeric string,
}

오류 코드

오류설명
100Invalid parameter

업데이트 중

이 엔드포인트에서 수행할 수 없는 작업입니다.

삭제 중

이 엔드포인트에서 수행할 수 없는 작업입니다.