创建提示消息
如果使用提示请求注册拉取,Microsoft将具有以下表单的消息发送到指定的终结点,要求你确定自上次拉取请求以来的任何行程更改。 在载入时,由你决定请求的频率。
<?xml version="1.0" encoding="UTF-8"?>
<HintRequest id="123-abc" timestamp="2017-10-21T08:45:09Z">
<LastFetchTime>2017-10-21T08:30:16Z</LastFetchTime>
</HintRequest>
元素 LastFetchTime
标识您最后一次成功发送响应的 UTC 日期和时间,该响应Microsoft标识了行程更改。 如果自该时间以来未发生任何更改,则响应应包含空正文。 如果已更改,则正文包含 提示 消息,用于标识已更改的行程。 可以使用以下方法之一确定行程:
确切的行程
提示消息可以使用检查日期和停留时长来标识各个行程。 以下示例显示了一条提示消息,该消息指定单个酒店的单个行程。
<Hint>
<Item>
<Property>789</Property>
<Stay>
<CheckInDate>2017-10-20</CheckInDate>
<LengthOfStay>2</LengthOfStay>
</Stay>
</Item>
</Hint>
每个 <项目> 表示单个行程。 您可以为每个要更新的行程指定一个 <Item> 对象,每个行程可以指定一个或多个属性。
当Microsoft收到上述提示时,它会向你发送以下 查询 消息:
<Query>
<Checkin>2017-10-20</Checkin>
<Nights>2</Nights>
<PropertyList>
<Property>789</Property>
</PropertyList>
</Query>
收到查询消息时,响应应包含以下 Result>的价格源<。
<Result>
<Property>789</Property>
<Checkin>2017-10-20</Checkin>
<Nights>2</Nights>
<!-- Pricing and other elements that changed -->
</Result>
如果上述提示指定了两个属性,则 Price 源将包含两 <个 Result> 元素, (每个属性) 一个。
签入日期范围
提示消息可以识别一系列行程。 若要指定范围,请将 FirstDate
元素设置为起始检查日期,将 LastDate
设置为最后检查日期。 以下示例显示了一条提示消息,该消息使用日期范围为单个属性指定六个检查日期。
<?xml version="1.0" encoding="UTF-8"?>
<Hint>
<Item>
<Property>123</Property>
<FirstDate>2017-10-20</FirstDate>
<LastDate>2017-10-25</LastDate>
</Item>
</Hint>
每个<项>表示单个检查日期范围。 您可以为每个标识要更新的行程的检查日期范围指定一个 <Item> 对象,每个对象可以指定一个或多个属性。
当Microsoft收到上述提示时,它会向你发送以下 查询 消息。
<Query>
<FirstDate>2017-10-20</FirstDate>
<LastDate>2017-10-25</LastDate>
<Nights>3</Nights>
<PropertyList>
<Property>123</Property>
</PropertyList>
</Query>
收到查询消息时,响应应包含以下 Result> 对象的 Price 源<。
<Result>
<Property>789</Property>
<Checkin>2017-10-20</Checkin>
<Nights>1</Nights>
<!-- Pricing and other elements that changed -->
</Result>
<Result>
<Property>789</Property>
<Checkin>2017-10-20</Checkin>
<Nights>2</Nights>
<!-- Pricing and other elements that changed -->
</Result>
<Result>
<Property>789</Property>
<Checkin>2017-10-20</Checkin>
<Nights>3</Nights>
<!-- Pricing and other elements that changed -->
</Result>
. . .
<Result>
<Property>789</Property>
<Checkin>2017-10-25</Checkin>
<Nights>1</Nights>
<!-- Pricing and other elements that changed -->
</Result>
<Result>
<Property>789</Property>
<Checkin>2017-10-25</Checkin>
<Nights>2</Nights>
<!-- Pricing and other elements that changed -->
</Result>
<Result>
<Property>789</Property>
<Checkin>2017-10-25</Checkin>
<Nights>3</Nights>
<!-- Pricing and other elements that changed -->
</Result>
对于此示例,Price 源应包含的最大结果数为 18 (6 个检查日期 *) 3 晚。 如果日期范围的某些行程未更改,则价格源的包含量可能会减少。
扩展检查日期范围
展开的检查日期范围提示类似于检查日期范围提示,只不过它要求你包括日期范围中与行程相交的所有行程。 因此,您的价格源应包括检查日期在日期范围内的任何行程。
<StaysIncludingRange> 将提示标识为展开的检查日期范围提示。 若要指定范围,请将 FirstDate
元素设置为起始检查日期,将 LastDate
设置为最后检查日期。 以下示例显示了一条提示消息,该消息使用日期范围为单个属性指定六个检查日期。
<?xml version="1.0" encoding="UTF-8"?>
<Hint>
<Item>
<Property>123</Property>
<StaysIncludingRange>
<FirstDate>2017-10-20</FirstDate>
<LastDate>2017-10-25</LastDate>
</StaysIncludingRange>
</Item>
</Hint>
每个 <项目> 表示单个行程范围。 您可以为每个标识要更新的行程的检查日期范围指定一个 <Item> 对象,每个对象可以指定一个或多个属性。
当Microsoft收到上述提示时,它会向你发送以下 查询 消息。
MaxLengthOfStay
QueryControl 消息中的设置确定 AffectedNights> 的值<, (此示例假定它设置为 3) 。
<Query>
<FirstDate>2017-10-20</FirstDate>
<LastDate>2017-10-25</LastDate>
<AffectedNights>3</AffectedNights>
<PropertyList>
<Property>123</Property>
</PropertyList>
</Query>
收到查询消息时,响应应包含以下 Result> 对象的 Price 源<。 请注意,前几个对象的检查日期早于FirstDate
提示中的日期。 这是因为检查出日期的行程在提示的日期范围内。
<Result>
<Property>789</Property>
<Checkin>2017-10-17</Checkin>
<Nights>3</Nights>
<!-- Pricing and other elements that changed -->
</Result>
<Result>
<Property>789</Property>
<Checkin>2017-10-18</Checkin>
<Nights>2</Nights>
<!-- Pricing and other elements that changed -->
</Result>
<Result>
<Property>789</Property>
<Checkin>2017-10-18</Checkin>
<Nights>3</Nights>
<!-- Pricing and other elements that changed -->
</Result>
<Result>
<Property>789</Property>
<Checkin>2017-10-19</Checkin>
<Nights>1</Nights>
<!-- Pricing and other elements that changed -->
</Result>
<Result>
<Property>789</Property>
<Checkin>2017-10-19</Checkin>
<Nights>2</Nights>
<!-- Pricing and other elements that changed -->
</Result>
<Result>
<Property>789</Property>
<Checkin>2017-10-19</Checkin>
<Nights>3</Nights>
<!-- Pricing and other elements that changed -->
</Result>
<Result>
<Property>789</Property>
<Checkin>2017-10-20</Checkin>
<Nights>1</Nights>
<!-- Pricing and other elements that changed -->
</Result>
. . .
<Result>
<Property>789</Property>
<Checkin>2017-10-25</Checkin>
<Nights>1</Nights>
<!-- Pricing and other elements that changed -->
</Result>
<Result>
<Property>789</Property>
<Checkin>2017-10-25</Checkin>
<Nights>2</Nights>
<!-- Pricing and other elements that changed -->
</Result>
<Result>
<Property>789</Property>
<Checkin>2017-10-25</Checkin>
<Nights>3</Nights>
<!-- Pricing and other elements that changed -->
</Result>
批处理查询
根据需要更新的属性和行程的数量,Microsoft向你发送几个较小的查询,而不是一个大查询。 例如,如果需要更新 1,000 个属性的行程,Microsoft可能会向你发送 100 条查询消息,每个查询消息包含 10 个属性。