这是自动生成的译文

检索属性静态数据

SDP(静态数据平台)提供各种类型的静态数据,这些数据不会经常更改,例如房产 ID、名称、描述、地址、设施等等。

利用此平台的一种方法是将这些数据托管在本地,定期更新,并且仅对可用性和价格等波动数据调用住宿 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 搜索中查看获取房产内容、价格和可用性的示例

但是,目前在住宿列表中,Vrbo 上不包含 instant-bookable 的房源将无法访问。********

LISTINGS文件中,您可以通过检查 propertyId.vrbo字段是否为空来识别 Vrbo 属性,并按 vrboPropertyType.instantBook字段进行筛选。

从 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 房源的 Expedia 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 可用于调用住宿报价 API 或住宿可用性日历 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 可以帮助您减少对住宿 API 的实时调用次数,从而节省成本。你还可以利用这些数据构建自己的搜索引擎或推荐系统。

该页面有帮助吗?
我们该如何改进这些内容?
感谢您帮助我们改进!