Mẫu trọng tải danh sách chờ
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
BatchGetWaitEstimates
Ví dụ này minh hoạ trường hợp một nhà hàng thường cho phép các giá trị party_size
từ 2 đến 10, nhưng tại thời điểm yêu cầu, các giá trị party_size
cao hơn 7 không thể được chấp nhận nữa (ví dụ: gần đến giờ đóng cửa) và party_size
là 2 thì thực sự không phải chờ đợi.
Nhận yêu cầu chờ
{
"merchant_id": "dining-1",
"party_size": [2, 3, 4, 5, 6, 7, 8, 9, 10],
"service_id": "reservation"
}
Nhận phản hồi chờ
{
"waitlist_status": "OPEN",
"wait_estimate": [
{ "party_size": 2, "wait_length": {} },
{ "party_size": 3, "wait_length": { "parties_ahead_count": 3 } },
{ "party_size": 4, "wait_length": { "parties_ahead_count": 3 } },
{ "party_size": 5, "wait_length": { "parties_ahead_count": 3 } },
{ "party_size": 6, "wait_length": { "parties_ahead_count": 3 } },
{ "party_size": 7, "wait_length": { "parties_ahead_count": 3 } }
]
}
CreateWaitlistEntry
Tạo yêu cầu
{
"idempotency_token": "14620365692592881354",
"merchant_id": "dining-1",
"party_size": 3,
"service_id": "reservation",
"user_information": {
"family_name": "John",
"given_name": "Smith",
"telephone": "+81 80-1111-2222",
"user_id": "123456789"
}
}
Tạo phản hồi
{ "waitlist_entry_id": "MYS-1668739060" }
GetWaitlistEntry
Yêu cầu GET
{ "waitlist_entry_id": "MYS-1668739060" }
Nhận phản hồi
{
"waitlist_entry": {
"wait_estimate": {
"party_size": 3,
"wait_length": { "parties_ahead_count": 3 }
},
"waitlist_entry_state": "WAITING",
"waitlist_entry_state_times": { "created_time_seconds": 1234567890 }
}
}
DeleteWaitlistEntry
Xóa yêu cầu
{ "waitlist_entry_id": "MYS-1668739060" }
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-07-26 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2025-07-26 UTC."],[[["\u003cp\u003e\u003ccode\u003eBatchGetWaitEstimates\u003c/code\u003e allows merchants to retrieve the current wait times for various party sizes for a specific service, such as reservations.\u003c/p\u003e\n"],["\u003cp\u003eThe response includes a \u003ccode\u003ewaitlist_status\u003c/code\u003e indicating if the waitlist is open and a list of \u003ccode\u003ewait_estimate\u003c/code\u003e objects detailing the estimated wait for each party size, potentially using \u003ccode\u003eparties_ahead_count\u003c/code\u003e or remaining empty for immediate seating.\u003c/p\u003e\n"],["\u003cp\u003eUsing \u003ccode\u003eCreateWaitlistEntry\u003c/code\u003e, \u003ccode\u003eGetWaitlistEntry\u003c/code\u003e, and \u003ccode\u003eDeleteWaitlistEntry\u003c/code\u003e, users can add themselves to the waitlist, check their status and estimated wait, and remove themselves from the waitlist, respectively.\u003c/p\u003e\n"],["\u003cp\u003eWait estimates can vary based on real-time availability and operational constraints, such as party size limitations near closing time.\u003c/p\u003e\n"]]],["The provided content details waitlist management for a restaurant. It begins by checking wait estimates for party sizes 2-10, revealing that parties over 7 cannot be accommodated and party size 2 has no wait. A new waitlist entry is then created for a party of 3, assigning it an ID. Retrieving that ID confirms the party is waiting with 3 parties ahead. Finally the entry is deleted.\n"],null,["# Waitlists Payload Sample\n\n### BatchGetWaitEstimates\n\n\nThis example illustrates a case where a restaurant usually allows `party_size` values\nfrom 2 to 10 but at the time of the request, `party_size` values higher than 7 can no\nlonger be accomodated (close to closing time, for example) and `party_size` of 2 has\nactually no wait. \n\n### Get wait request\n\n```scdoc\n{\n \"merchant_id\": \"dining-1\",\n \"party_size\": [2, 3, 4, 5, 6, 7, 8, 9, 10],\n \"service_id\": \"reservation\"\n}\n```\n\n### Get wait response\n\n```scdoc\n{\n \"waitlist_status\": \"OPEN\",\n \"wait_estimate\": [\n { \"party_size\": 2, \"wait_length\": {} },\n { \"party_size\": 3, \"wait_length\": { \"parties_ahead_count\": 3 } },\n { \"party_size\": 4, \"wait_length\": { \"parties_ahead_count\": 3 } },\n { \"party_size\": 5, \"wait_length\": { \"parties_ahead_count\": 3 } },\n { \"party_size\": 6, \"wait_length\": { \"parties_ahead_count\": 3 } },\n { \"party_size\": 7, \"wait_length\": { \"parties_ahead_count\": 3 } }\n ]\n}\n```\n\n### CreateWaitlistEntry\n\n### Create request\n\n```scdoc\n{\n \"idempotency_token\": \"14620365692592881354\",\n \"merchant_id\": \"dining-1\",\n \"party_size\": 3,\n \"service_id\": \"reservation\",\n \"user_information\": {\n \"family_name\": \"John\",\n \"given_name\": \"Smith\",\n \"telephone\": \"+81 80-1111-2222\",\n \"user_id\": \"123456789\"\n }\n}\n```\n\n### Create response\n\n```scdoc\n{ \"waitlist_entry_id\": \"MYS-1668739060\" }\n```\n\n### GetWaitlistEntry\n\n### Get request\n\n```scdoc\n{ \"waitlist_entry_id\": \"MYS-1668739060\" }\n```\n\n### Get response\n\n```scdoc\n{\n \"waitlist_entry\": {\n \"wait_estimate\": {\n \"party_size\": 3,\n \"wait_length\": { \"parties_ahead_count\": 3 }\n },\n \"waitlist_entry_state\": \"WAITING\",\n \"waitlist_entry_state_times\": { \"created_time_seconds\": 1234567890 }\n }\n}\n```\n\n### DeleteWaitlistEntry\n\n### Delete request\n\n```scdoc\n{ \"waitlist_entry_id\": \"MYS-1668739060\" }\n```\n\n### Delete response\n\n```text\n{}\n```"]]