预订等候名单 - 通过 API 查询商家状态
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
使用场景
Google Maps Booking API 提供了两种方法,可用于以编程方式检索各个商家的状态,以便进行各种集成或使用本地服务广告广告资源。
Merchant Status API 的用例:
- 改进现有的客户关系管理工具,向客户展示其商品目录在 Google 上的展示方式。
- 构建信息中心,以跟踪商家的商品目录状态和匹配状态。
- 以编程方式检索商家的匹配状态和可预订状态,并更正所有不正确的信息,以提高数据质量。
商家状态包含哪些信息
MerchantStatus 包含以下信息:
- 商家商品目录状态:适用于预订型商家和/或等候名单商家。
- 商家匹配状态:包含匹配的商家信息的详细信息
- 仅适用于 Google 本地生活服务广告)匹配的商家服务提供商:包括客户 ID 和服务类别。
- 用于演示商家在 Google 上的展示方式的网址。
查询单个商家的状态
您可以使用 inventory.partners.merchants.getStatus 获取单个商家的状态:
GET https://mapsbooking.googleapis.com/v1alpha/inventory/partners/{partnerId}/merchants/{merchantId}/status
以下是 Python 代码示例(如需查看更多语言的示例,请点击此处):
from google.auth.transport.requests import AuthorizedSession
from google.oauth2 import service_account
credentials = service_account.Credentials.from_service_account_file(
'./your_key.json')
scoped_credentials = credentials.with_scopes(
['https://www.googleapis.com/auth/mapsbooking'])
authed_session = AuthorizedSession(scoped_credentials)
response = authed_session.get('https://partnerdev-mapsbooking.googleapis.com' +
'/v1alpha/inventory/partners/123456789/merchants/001/status')
MerchantStatus 响应示例如下:
{
"name": "partners/123456789/merchants/001/status",
"merchantName": "Foo Bar Restaurant",
"inputGeoInfo": {
"unstructured_address": "123 Foo Bar Street, Mountain View"
},
"processingStatus": "COMPLETED",
"bookingStatus": {
"hasValidFutureInventory": true
},
"waitlistStatus": {
"hasValidWaitlistService": true
}
"geoMatch": {
"name": "Foo Bar Restaurant",
"formattedAddress": "123 Foo Bar St, Mountain View, CA 94043",
"placeId": "ChIAAAAAAAAABBBBBBBB"
},
"directUrls": [
{
"type": "BOOKING",
"url": "https://reserve-partnerdev.sandbox.google.com/maps/reserve/v/dine/m/Nwaaaaa"
},
{
"type": "WAITLIST",
"url": "https://reserve-partnerdev.sandbox.google.com/maps/reserve/v/wait/c/iDbbbbb"
}
]
}
批量检索商家状态
您可以使用 inventory.partners.merchants.status.list 检索所有商家或满足特定商品目录/匹配条件的一组商家的状态。例如,您可以执行以下调用,以获取所有具有有效未来日期预订商品目录的未匹配商家:
GET https://mapsbooking.googleapis.com/v1alpha/inventory/partners/{partnerId}/merchants/status?pageSize=50&bookingInventoryStatusRestrict=HAS_VALID_FUTURE_INVENTORY&geoMatchRestrict=GEO_UNMATCHED
示例响应如下所示:
{
"merchantStatuses": [
{
"name": "partners/123456789/merchants/002/status",
"merchantName": "Bar Foo Restaurant",
"inputGeoInfo": {
"unstructured_address": "234 Bar Foo Street, Mountain View"
},
"processingStatus": "COMPLETED",
"bookingStatus": {
"hasValidFutureInventory": true
},
"waitlistStatus": {},
},
...
{
"name": "partners/123456789/merchants/080/status",
"merchantName": "Baz Restaurant",
"inputGeoInfo": {
"unstructured_address": "345 Baz Street, Mountain View"
},
"processingStatus": "COMPLETED",
"bookingStatus": {
"hasValidFutureInventory": true
},
"waitlistStatus": {
"hasValidWaitlistService": true
},
},
],
"nextPageToken": "AAABBBB"
}
此响应将包含 50 个满足过滤条件且按 merchant_id
排序的 MerchantStatus。响应中还包含用于查询下一页的页面令牌(如果不是最后一页)。
请注意:过滤条件应在所有网页中保持一致。
最佳做法
由于商家状态在大多数情况下不会频繁更改,因此建议您缓存检索到的结果,并定期(例如每隔几个小时)通过新查询检索这些结果。如果每秒请求数量过高,Action Center 可能会限制您的查询。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-26。
[null,null,["最后更新时间 (UTC):2025-07-26。"],[[["\u003cp\u003eGoogle Maps Booking API lets you programmatically check the status of individual merchants for integrations or Local Services Ads inventory.\u003c/p\u003e\n"],["\u003cp\u003eYou can use the Merchant Status API to track inventory, enhance customer relationship tools, and improve data quality.\u003c/p\u003e\n"],["\u003cp\u003eMerchant status provides details on inventory, matching status, service provider (for Local Services Ads), and Google surfacing.\u003c/p\u003e\n"],["\u003cp\u003eThe API offers methods to look up the status of single or multiple merchants based on specified criteria.\u003c/p\u003e\n"],["\u003cp\u003eCaching retrieved results and periodic refreshes are recommended to avoid excessive API requests and potential throttling.\u003c/p\u003e\n"]]],["The Merchant Status API offers methods to retrieve merchant inventory and matching status for Google integrations like Local Services Ads. Key actions include: retrieving a single merchant's status via a GET request, and bulk retrieval of statuses based on inventory or matching conditions. The MerchantStatus data includes inventory status, matching details, associated URLs, and optionally, service provider data for Local Services Ads. Caching retrieved results for several hours is encouraged to manage the rate of API requests.\n"],null,["# Reservations Waitlists Querying Merchant Status via the API\n\nUse cases\n---------\n\n\n[Google Maps Booking API](/maps-booking/reference/maps-booking-api/rest) provides two methods, which can be used\nto programmatically retrieve a status of the individual merchants for\nvarious integrations or\n[Local Services Ads](https://ads.google.com/local-services-ads)\ninventory.\n\nUse cases for Merchant Status API:\n\n- Enhance existing customer relation management tools to demonstrate your customers how their inventory is surfaced on Google.\n- Build a dashboard to track the inventory status and matching status of your merchants.\n- Programmatically retrieve matching and bookable statuses of your merchants and fix any incorrect information to improve data quality.\n\nWhat does the merchant status contain\n-------------------------------------\n\nThe\n[MerchantStatus](/maps-booking/reference/maps-booking-api/rest/v1alpha/MerchantStatus) contains the following information:\n\n- Merchant inventory status: applies to both booking and/or waitlist merchants.\n- Merchant matching status: includes details on the matched business listing\n- For [Google Local Services Ads](https://ads.google.com/local-services-ads) only) Matched merchant service provider: includes the customer ID and service categories.\n- The URLs to demonstrate how the merchant is surfaced on Google.\n\nLook up a single merchant status\n--------------------------------\n\nYou can get the status of a single merchant using\n[inventory.partners.merchants.getStatus](/maps-booking/reference/maps-booking-api/rest/v1alpha/inventory.partners.merchants/getStatus): \n\n```text\nGET https://mapsbooking.googleapis.com/v1alpha/inventory/partners/{partnerId}/merchants/{merchantId}/status\n```\n\nHere is a Python code sample (see examples in more languages\n[here](/actions-center/verticals/reservations/waitlists/reference/real-time-updates-rest/code-samples)): \n\n```python\nfrom google.auth.transport.requests import AuthorizedSession\nfrom google.oauth2 import service_account\n\ncredentials = service_account.Credentials.from_service_account_file(\n './your_key.json')\nscoped_credentials = credentials.with_scopes(\n ['https://www.googleapis.com/auth/mapsbooking'])\nauthed_session = AuthorizedSession(scoped_credentials)\n\nresponse = authed_session.get('https://partnerdev-mapsbooking.googleapis.com' +\n '/v1alpha/inventory/partners/123456789/merchants/001/status')\n```\n\nAn example\n[MerchantStatus](/maps-booking/reference/maps-booking-api/rest/v1alpha/MerchantStatus) response looks like: \n\n```carbon\n {\n \"name\": \"partners/123456789/merchants/001/status\",\n \"merchantName\": \"Foo Bar Restaurant\",\n \"inputGeoInfo\": {\n \"unstructured_address\": \"123 Foo Bar Street, Mountain View\"\n },\n \"processingStatus\": \"COMPLETED\",\n \"bookingStatus\": {\n \"hasValidFutureInventory\": true\n },\n \"waitlistStatus\": {\n \"hasValidWaitlistService\": true\n }\n \"geoMatch\": {\n \"name\": \"Foo Bar Restaurant\",\n \"formattedAddress\": \"123 Foo Bar St, Mountain View, CA 94043\",\n \"placeId\": \"ChIAAAAAAAAABBBBBBBB\"\n },\n \"directUrls\": [\n {\n \"type\": \"BOOKING\",\n \"url\": \"https://reserve-partnerdev.sandbox.google.com/maps/reserve/v/dine/m/Nwaaaaa\"\n },\n {\n \"type\": \"WAITLIST\",\n \"url\": \"https://reserve-partnerdev.sandbox.google.com/maps/reserve/v/wait/c/iDbbbbb\"\n }\n ]\n }\n```\n\nRetrieve merchant statuses in bulk\n----------------------------------\n\nYou can retrieve statuses of all merchants, or a group of merchants\nsatisfying certain inventory/matching conditions, using\n[inventory.partners.merchants.status.list](/maps-booking/reference/maps-booking-api/rest/v1alpha/inventory.partners.merchants.status/list). For example, you can make\nthis call to get all unmatched merchants with valid future-dated booking\ninventory: \n\n```scdoc\nGET https://mapsbooking.googleapis.com/v1alpha/inventory/partners/{partnerId}/merchants/status?pageSize=50&bookingInventoryStatusRestrict=HAS_VALID_FUTURE_INVENTORY&geoMatchRestrict=GEO_UNMATCHED\n```\n\nA sample response would look like this: \n\n```carbon\n {\n \"merchantStatuses\": [\n {\n \"name\": \"partners/123456789/merchants/002/status\",\n \"merchantName\": \"Bar Foo Restaurant\",\n \"inputGeoInfo\": {\n \"unstructured_address\": \"234 Bar Foo Street, Mountain View\"\n },\n \"processingStatus\": \"COMPLETED\",\n \"bookingStatus\": {\n \"hasValidFutureInventory\": true\n },\n \"waitlistStatus\": {},\n },\n ...\n {\n \"name\": \"partners/123456789/merchants/080/status\",\n \"merchantName\": \"Baz Restaurant\",\n \"inputGeoInfo\": {\n \"unstructured_address\": \"345 Baz Street, Mountain View\"\n },\n \"processingStatus\": \"COMPLETED\",\n \"bookingStatus\": {\n \"hasValidFutureInventory\": true\n },\n \"waitlistStatus\": {\n \"hasValidWaitlistService\": true\n },\n },\n ],\n \"nextPageToken\": \"AAABBBB\"\n }\n```\n\nThis response will contain 50\n[MerchantStatus](/maps-booking/reference/maps-booking-api/rest/v1alpha/MerchantStatus) that satisfy the filtering conditions and ordered by\n`merchant_id`. The response also contains a page token (if it is\nnot the last page) to query the next page.\n\nPlease note: the filtering conditions should be consistent across all\npages.\n\nBest Practices\n--------------\n\nSince merchant statuses do not change frequently in most times, it is\nencouraged to cache the retrieved results and periodically (e.g. every few\nhours) retrieve them via new queries. The Actions Center may throttle your\nqueries if the number of requests per second deem to be excessively high."]]