API를 통한 판매자 상태 쿼리

사용 사례

Google Maps Booking API는 다양한 Actions Center 통합 또는 지역 서비스 광고 인벤토리에 대한 개별 판매자의 상태를 프로그래매틱 방식으로 가져오는 데 사용할 수 있는 두 가지 메서드를 제공합니다.

Merchant Status API의 사용 사례:

  • 기존 고객 관계 관리 도구를 개선하여 고객에게 Actions Center 플랫폼에 인벤토리가 어떻게 표시되는지 보여줍니다.
  • 대시보드를 빌드하여 판매자의 인벤토리 상태 및 일치 상태를 추적합니다.
  • 판매자의 일치 및 예약 가능한 상태를 프로그래매틱 방식으로 가져오고 잘못된 정보를 수정하여 데이터 품질을 개선합니다.

판매자 상태에는 무엇이 포함되나요?

MerchantStatus에는 다음 정보가 포함됩니다.

  • 판매자 인벤토리 상태: 예약 및 대기자 명단 판매자에게 모두 적용됩니다.
  • 판매자 일치 상태: 일치하는 비즈니스 정보에 대한 세부정보가 포함됩니다.
  • Google 지역 서비스 광고만 해당) 일치하는 판매자 서비스 제공업체: 고객 ID 및 서비스 카테고리가 포함됩니다.
  • 판매자가 Google 예약을 통해 표시되는 방식을 보여주는 URL입니다.

단일 판매자 상태 조회

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"
  }

이 응답에는 필터링 조건을 충족하고 merchant_id에 따라 정렬된 50개의 MerchantStatus가 포함됩니다. 응답에는 다음 페이지를 쿼리하기 위한 페이지 토큰 (마지막 페이지가 아닌 경우)도 포함됩니다.

참고: 필터링 조건은 모든 페이지에서 일관되어야 합니다.

권장사항

판매자 상태는 대부분의 경우 자주 변경되지 않으므로 검색된 결과를 캐시하고 주기적으로 (예: 몇 시간마다) 새 쿼리를 통해 검색하는 것이 좋습니다. 초당 요청 수가 과도하게 많다고 판단되면 작업 센터에서 쿼리를 제한할 수 있습니다.