การจับคู่ผู้ขาย URL ของ Maps

กรณีการใช้งาน

Google Maps Booking API มี 2 วิธีที่ใช้ได้ ในการเรียกสถานะผู้ขายแต่ละรายแบบเป็นโปรแกรม การผสานรวมที่หลากหลายหรือ โฆษณาบริการในพื้นที่ พื้นที่โฆษณา

กรณีการใช้งานสำหรับ API สถานะผู้ขาย

  • ปรับปรุงเครื่องมือการจัดการลูกค้าสัมพันธ์ที่มีอยู่เพื่อแสดงให้เห็นถึง ลูกค้าจะเห็นอย่างไรว่าสินค้าคงคลังของตนปรากฏบน Google อย่างไร
  • สร้างหน้าแดชบอร์ดเพื่อติดตามสถานะสินค้าคงคลังและสถานะการจับคู่ ผู้ขายของคุณ
  • ดึงข้อมูลสถานะการจับคู่และจองได้แบบเป็นโปรแกรม ผู้ขายและแก้ไขข้อมูลที่ไม่ถูกต้องเพื่อปรับปรุงคุณภาพข้อมูล

สถานะผู้ขายประกอบด้วยอะไรบ้าง

MerchantStatus มีข้อมูลต่อไปนี้

  • สถานะสินค้าคงคลังของผู้ขาย: มีผลกับทั้งผู้ขายที่จองและ/หรือเข้าคิวรอ
  • สถานะการจับคู่ผู้ขาย: ประกอบด้วยรายละเอียดในข้อมูลธุรกิจที่ตรงกัน
  • สำหรับ โฆษณาบริการในพื้นที่ของ Google เท่านั้น) ผู้ให้บริการผู้ขายที่ตรงกัน ได้แก่ ประกอบด้วยรหัสลูกค้าและหมวดหมู่บริการ
  • URL ที่จะสาธิตวิธีที่ผู้ขายปรากฏบน 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 MerchantStatus ที่ตรงตามเงื่อนไขการกรองและเรียงลำดับตาม merchant_id การตอบกลับยังมีโทเค็นของหน้าเว็บด้วย (หากใช่ ไม่ใช่หน้าสุดท้าย) เพื่อค้นหาหน้าถัดไป

โปรดทราบว่าเงื่อนไขการกรองควรสอดคล้องกันในทุก

แนวทางปฏิบัติแนะนำ

เนื่องจากโดยส่วนใหญ่ สถานะผู้ขายไม่ได้เปลี่ยนแปลงบ่อย แนะนำให้เก็บผลลัพธ์ที่เรียกมาและเก็บเป็นระยะๆ (เช่น ทุก ชั่วโมง) ดึงข้อมูลผ่านคำค้นหาใหม่ ศูนย์การดำเนินการอาจควบคุม การค้นหาหากจำนวนคำขอต่อวินาทีเห็นว่าสูงเกินไป