调用Microsoft Bookings API创建预约时持续返回UnknownError
使用Microsoft Graph API创建Bookings预约时持续返回UnknownError的问题
背景
已成功调用其他Booking API,熟悉访问令牌、权限及输入schema。
使用的API端点
POST https://graph.microsoft.com/v1.0/solutions/bookingBusinesses/{businessId}/appointments
已授予的权限
- Bookings.Manage.All
- Bookings.ReadWrite.All
- BookingsAppointment.ReadWrite.All
- Bookings.Read.All
请求Payload
{ "@odata.type": "#microsoft.graph.bookingAppointment", "customerTimeZone": "UTC", "customerName": "XXXX XXXXXX", "customerEmailAddress": "email address removed for privacy reasons", "customerPhone": "xxxxxxxxx", "customerNotes": null, "smsNotificationsEnabled": false, "end": { "@odata.type": "#microsoft.graph.dateTimeTimeZone", "dateTime": "2025-01-21T08:00:00", "timeZone": "UTC" }, "isCustomerAllowedToManageBooking": true, "isLocationOnline": true, "optOutOfCustomerEmail": false, "anonymousJoinWebUrl": null, "duration": "PT30M", "postBuffer": "PT15M", "preBuffer": "PT15M", "price": 0.0, "email address removed for privacy reasons": "#microsoft.graph.bookingPriceType", "priceType": "notSet", "email address removed for privacy reasons": "#Collection(microsoft.graph.bookingReminder)", "reminders": [ { "@odata.type": "#microsoft.graph.bookingReminder", "message": "This service is tomorrow", "offset": "P1D", "email address removed for privacy reasons": "#microsoft.graph.bookingReminderRecipients", "recipients": "allAttendees" }, { "@odata.type": "#microsoft.graph.bookingReminder", "message": "Please be available to enjoy your lunch service.", "offset": "PT1H", "email address removed for privacy reasons": "#microsoft.graph.bookingReminderRecipients", "recipients": "customer" } ], "serviceId": "1fd13b39-6fbe-45c6-9acf-5585592165a9", "serviceLocation": { "@odata.type": "#microsoft.graph.location", "address": { "@odata.type": "#microsoft.graph.physicalAddress", "city": "Bangkok", "countryOrRegion": "Thailand", "postalCode": "10400", "postOfficeBox": null, "state": "", "street": "XXXX Tower", "email address removed for privacy reasons": "#microsoft.graph.physicalAddressType", "type": null }, "coordinates": null, "displayName": "Customer location", "locationEmailAddress": null, "email address removed for privacy reasons": "#microsoft.graph.locationType", "locationType": null, "locationUri": null, "uniqueId": null, "email address removed for privacy reasons": "#microsoft.graph.locationUniqueIdType", "uniqueIdType": null }, "serviceName": "Retirement Planning", "serviceNotes": "XXXXXX", "staffMemberIds": [ "d5586df3-fb3e-4328-b91a-607a081b1acd" ], "start": { "@odata.type": "#microsoft.graph.dateTimeTimeZone", "dateTime": "2025-01-21T07:30:00", "timeZone": "UTC" }, "maximumAttendeesCount": 1, "filledAttendeesCount": 1, "email address removed for privacy reasons": "#Collection(microsoft.graph.bookingCustomerInformation)", "customers": [ { "@odata.type": "#microsoft.graph.bookingCustomerInformation", "name": "XXXXX XXXXX", "emailAddress": "email address removed for privacy reasons", "phone": "XXXXXXXXX", "timeZone": "", "notes": "", "location": { "displayName": "", "locationEmailAddress": "", "locationUri": "", "locationType": "default", "uniqueId": null, "uniqueIdType": null, "address": { "street": "", "city": "", "state": "", "countryOrRegion": "", "postalCode": "" } } } ] }
错误响应
{ "error": { "code": "UnknownError", "message": "", "innerError": { "date": "2025-01-16T09:59:57", "request-id": "f8fbd949-cae5-42c4-a7dc-35d53c35bd7b", "client-request-id": "f8fbd949-cae5-42c4-a7dc-35d53c35bd7b" } } }
已采取的排查步骤
- 验证权限:确认访问令牌包含上述必要角色;
- 检查请求Payload:确保所有必填字段存在且格式正确,包括显式添加customer信息的@odata.type属性;
- 遵循业务规则:验证预约时长与服务定义时长匹配,且所有ID(客户、服务、员工)均有效;
- 查阅社区讨论:发现类似问题但未找到明确解决方案;
- 移除部分参数(包括customerEmailAddress、end、start等重要参数)仍返回UnknownError;
- 添加无效参数仍返回UnknownError;
- 添加无效参数+错误格式参数(如customerPhone设为整数)时,返回含验证错误的UnknownError。
求助问题
- 是否有Microsoft Bookings或Azure AD中未注意到的额外配置?
- 如何获取更详细的错误信息或日志以定位UnknownError根源?
- Microsoft Graph API或Bookings API近期是否有更新导致此问题?
恳请社区提供解决思路与建议。
内容的提问来源于stack exchange,提问作者Woraphon T
相关产品推荐
相关产品推荐

