숙박 시설 정적 데이터 가져오기
SDP(정적 데이터 플랫폼) 는 숙박 시설 ID, 이름, 설명, 주소, 편의 시설 등 자주 변경되지 않는 다양한 유형의 정적 데이터를 제공합니다.
이 플랫폼을 활용하는 한 가지 방법은 해당 데이터를 사용자 측에서 로컬로 호스팅하고 정기적으로 업데이트한 뒤, 예약 가능 여부나 가격과 같이 변동성이 큰 데이터에 대해서만 Lodging API를 호출하는 것입니다. 이렇게 하면 실시간 API 호출 횟수를 줄이고 애플리케이션의 성능을 향상시킬 수 있습니다.
이 페이지에서는 SDP DownloadURL API를 사용하여 접근 가능한 숙박 시설 ID 목록과 해당 숙박 시설에 대한 위치 정보를 가져오는 방법을 설명합니다. SDP에서 지원하는 다른 정적 데이터에 대한 자세한 내용은 에서 확인하실 수 있습니다.
SDP DownloadURL API에서 Expedia 숙박 시설 ID 중 접근 가능한 항목을 가져오기
GetFeedDownloadUrlOperationParams getPropertyIdListParams =
GetFeedDownloadUrlOperationParams.builder()
// Use the type LISTINGS to get the list of accessible property IDs.
.type(GetFeedDownloadUrlOperationParams.Type.LISTINGS)
// Without any filters, this operation will return the information of all lodging
// properties in en_US by default.
.build();
GetFeedDownloadUrlOperation getFeedDownloadUrlOperation =
new GetFeedDownloadUrlOperation(getPropertyIdListParams);
Response<PresignedUrlResponse> downloadUrlListingsResponse =
client.execute(getFeedDownloadUrlOperation);
// Get the download URL from the response.
String listingsDownloadUrl = downloadUrlListingsResponse.getData()
.getBestMatchedFile()
.getDownloadUrl();다운로드 URL은 다양한 jsonl 파일이 들어 있는 zip 파일을 가리킵니다. Jsonl 파일의 각 줄에는 숙박 시설를 나타내는 JSON 객체가 포함되어 있습니다.
LISTINGS파일의 JSON 예시 한 줄입니다( propertyId.expedia필드는 Expedia ID 숙박 시설입니다):
{
"propertyId": {
"expedia": "1234567",
"hcom": "123456789",
"vrbo": "123.1234567.7654321"
},
"bookable": {
"expedia": true,
"hcom": true,
"vrbo": true
},
"propertyType": {
"id": 16,
"name": "Apartment"
},
"lastUpdated": "10-27-2024 13:41:16",
"country": "France",
"inventorySource": "vrbo",
"referencePrice": {
"value": "89.52",
"currency": "USD"
},
"vrboPropertyType": {
"instantBook": true
}
}LISTINGS파일에서 가져온 숙박 시설 ID를 사용하여 숙박 시설 목록 API를 호출할 수 있습니다. 의 숙박 시설 항목에 대한 내용, 가격 및 재고 현황을 확인하는 예시는 숙박 시설 ID 검색에서 볼 수 있습니다.
그러나 현재 숙박 시설 목록에서는 ( 가 아님) instant-bookable ( , 가 아님)에 등록된 Vrbo 숙박 시설만 확인할 수 있습니다.
LISTINGS파일에서 ‘ propertyId.vrbo ’ 필드가 비어 있는지 확인하고, ‘ vrboPropertyType.instantBook ’ 필드를 기준으로 필터링하면 Vrbo 숙박 시설를 식별할 수 있습니다.
SDP DownloadURL API에서 Vrbo 숙박 시설 ID를 가져오기
GetFeedDownloadUrlOperationParams getPropertyIdListParams =
GetFeedDownloadUrlOperationParams.builder()
// Use the type VACATION_RENTAL to get the list of accessible Vrbo property IDs.
.type(GetFeedDownloadUrlOperationParams.Type.VACATION_RENTAL)
// Without any filters, this operation will return the information of all Vrbo
// properties in en_US by default.
.build();
GetFeedDownloadUrlOperation getFeedDownloadUrlOperation =
new GetFeedDownloadUrlOperation(getPropertyIdListParams);
Response<PresignedUrlResponse> downloadUrlVacationRentalResponse =
client.execute(getFeedDownloadUrlOperation);
// Get the download URL from the response.
String vacationRentalDownloadUrl = downloadUrlListingsResponse.getData()
.getBestMatchedFile()
.getDownloadUrl();LISTINGS파일과 마찬가지로, 다운로드 URL은 jsonl 파일이 포함된 zip 파일을 가리키며, 이 파일의 각 행에는 Vrbo 숙박 시설를 나타내는 JSON 객체가 포함되어 있습니다.
VACATION_RENTAL파일의 JSON 예시 한 줄입니다( propertyId.expedia필드는 이 Vrbo(숙박 시설)의 익스피디아 ID입니다):
{
"propertyId": {
"expedia": "1234567",
"hcom": "987654321",
"vrbo": "123.1234567.7654321"
},
"country": "France",
"propertySize": {
"measurement": 441,
"units": "SQUARE_FEET"
},
"maxOccupancy": 4,
"bathrooms": {
"numberOfBathrooms": 1
},
"bedrooms": {
"numberOfBedrooms": 2
},
"houseRules": {
"partyOrEventRules": {
"partiesOrEventsPermitted": false,
"ownerPartyFreeText": "No events allowed"
},
"smokingRules": {
"smokingPermitted": false,
"ownerSmokingFreeText": "Smoking is not permitted"
},
"petRules": {
"petsPermitted": true,
"ownerPetsFreeText": "Pets allowed"
},
"childRules": {
"childrenPermitted": true,
"ownerChildrenFreeText": "Children allowed: ages 0-17 "
}
},
"propertyManager": {
"name": "Résidences Louis",
"hostType": "Professional"
},
"premierHost": true,
"propertyLiveDate": "2022-05-31"
}VACATION_RENTAL파일에서 가져온 Expedia 숙박 시설 ID는 Lodging Quotes API 또는 Lodging Availability Calendars API를 호출하는 데 사용할 수 있습니다. 의 숙박 견적 페이지()와 의 Vrbo 예약 가능 여부 캘린더()에서 숙박 시설의 가격 및 예약 가능 여부를 확인하는 예시를 볼 수 있습니다.
숙박 시설의 이름과 위치 정보를 조회합니다.
GetFeedDownloadUrlOperationParams getPropertyLocationParams =
GetFeedDownloadUrlOperationParams.builder()
// Use the type LOCATIONS to get the names and address of accessible properties.
.type(GetFeedDownloadUrlOperationParams.Type.LOCATIONS)
// If you are looking for Vrbo properties specifically, you can also filter the properties by brand.
// .brand(GetFeedDownloadUrlOperationParams.Brand.VRBO)
.build();
GetFeedDownloadUrlOperation getFeedDownloadUrlOperation =
new GetFeedDownloadUrlOperation(getPropertyLocationParams);
Response<PresignedUrlResponse> downloadUrlLocationsResponse =
client.execute(getFeedDownloadUrlOperation);
// Get the download URL from the response.
String locationsDownloadUrl = downloadUrlLocationsResponse.getData()
.getBestMatchedFile()
.getDownloadUrl();파일 구조는 다른 SDP 파일과 비슷합니다.
LOCATIONS파일의 JSON 예시 한 줄:
{
"propertyId": {
"expedia": "1234567",
"hcom": "987654321",
"vrbo": "123.1234567.1234567"
},
"propertyType": {
"id": 16,
"name": "Apartment"
},
"propertyName": "Property Name",
"address1": "",
"address2": "",
"city": "Newark",
"province": "Delaware",
"country": "United States",
"postalCode": "19711",
"geoLocation": {
"latitude": "10.999999",
"longitude": "-10.999999",
"obfuscated": false
},
"locationAttribute": {
"neighborhood": {
"id": "553248635976468695",
"name": "Westmoreland"
},
"city": {
"id": "8946",
"name": "Newark"
},
"region": {
"id": "6055689",
"name": "North Wilmington"
},
"airport": {
"id": "6028579",
"code": "ILG",
"name": "Wilmington, DE (ILG-New Castle)",
"distance": "13.17",
"unit": "km"
},
"distanceFromCityCenter": {
"distance": "1.24",
"unit": "km"
}
}
}이 단계에서 숙박 시설 이름 및 위치 정보를 숙박 시설 ID와 결합하여 로컬 캐시를 구축할 수 있습니다.
SDP를 유연하게 활용하면 Lodging API에 대한 실시간 호출 횟수를 줄이고 비용을 절감할 수 있습니다. 또한 이 데이터를 활용하여 나만의 검색 엔진이나 추천 시스템을 구축할 수도 있습니다.