Recuperar datos estáticos del alojamiento
La SDP (Plataforma de Datos Estáticos) ofrece distintos tipos de datos estáticos que no cambian con frecuencia, como los ID de los alojamientos, los nombres, las descripciones, las direcciones, los servicios y mucho más.
Una forma de usar esta plataforma es alojar estos datos localmente en tu propio servidor, actualizarlos con regularidad y solo recurrir a las API de Lodging para datos que cambian con frecuencia, como la disponibilidad y el precio. Si lo haces, podrás reducir el número de llamadas a la API en tiempo real y mejorar el rendimiento de tu aplicación.
En esta página se explica cómo obtener la lista de ID de los alojamientos disponibles y la información de ubicación de dichas propiedades mediante la API DownloadURL de SDP. Si quieres saber más sobre cómo acceder a otros datos estáticos compatibles con SDP, puedes encontrar más información aquí:.
Recuperar los ID de los alojamientos de « Expedia » a las que se puede acceder mediante la API SDP DownloadURL
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();La URL de descarga lleva a un archivo zip que contiene varios archivos jsonl. Cada línea de los archivos jsonl contiene un objeto JSON que representa una propiedad.
Una línea de ejemplo en formato JSON del archivo « LISTINGS » (el campo « propertyId.expedia » es el ID del alojamiento « Expedia »):
{
"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
}
}Los ID de los alojamientos que se obtienen del archivo « LISTINGS » se pueden usar para llamar a la API de anuncios de alojamientos. Puedes ver un ejemplo de cómo obtener el contenido, los precios y la disponibilidad de los alojamientos en la búsqueda por ID de propiedad de.
Sin embargo, las propiedades de Vrbo que son (NO) instant-bookable (NO**) están **(NO ) disponibles en los anuncios de alojamiento por ahora.
En el archivo « LISTINGS », puedes identificar las propiedades de Vrbo comprobando si los campos « propertyId.vrbo » están vacíos y filtrándolas por el campo « vrboPropertyType.instantBook ».
Obtener los ID de los alojamientos de Vrbo a través de la API DownloadURL de SDP
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();Al igual que en el archivo « LISTINGS », la URL de descarga apunta a un archivo zip que contiene archivos jsonl, en los que cada línea contiene un objeto JSON que representa una propiedad de Vrbo.
Una línea de ejemplo en formato JSON del archivo « VACATION_RENTAL » (el campo « propertyId.expedia » es el ID de Expedia de esta propiedad de Vrbo):
{
"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"
}Los ID de propiedad « Expedia » que se obtienen del archivo VACATION_RENTALse pueden usar para llamar a la API de presupuestos de alojamiento o a la API de calendarios de disponibilidad de alojamiento. Puedes ver ejemplos de cómo consultar los precios y la disponibilidad de alojamientos en (presupuestos de alojamiento), y (calendario de disponibilidad de Vrbo).
Obtener los nombres y la información sobre la ubicación de los alojamientos
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();La estructura del archivo es similar a la de otros archivos SDP.
Una línea de ejemplo en formato JSON del archivo « LOCATIONS »:
{
"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"
}
}
}Llegados a este punto, puedes combinar el nombre del alojamiento y la información sobre su ubicación con los identificadores de los alojamientos para crear tu caché local.
Un uso flexible de SDP puede ayudarte a reducir el número de llamadas en tiempo real a las API de alojamiento y a ahorrar en costes. También puedes usar los datos para crear tu propio motor de búsqueda o sistema de recomendaciones.