I'm trying to use the "Booking Business" endpoint in Microsoft Bookings through the graph API, but the documentation is not very clear on how to get it working. I am authenticating correctly, and everything appears to work, but I can't seem to actually trigger appointment creation and I can't find any way to get more meaningful feedback on why my requests are failing.
The core request I am sending looks like this:
POST https://graph.microsoft.com/v1.0/solutions/bookingBusinesses/MyCalendar@MyOrg.com/appointments
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.bookingAppointment",
"serviceId": "a98309e9-3104-411f-q681-71c7df95a178",
"duration": "PT30M",
"start_date_time":
{
"dateTime": "2022-12-22T14:30:00+00:00",
"timeZone": "UTC"
},
"staffMemberIds":
[
"e220feb5-5bc-43c6-922z-a2cd5a545ec2"
],
"isLocationOnline": true,
"filedAttendeeCount": 1,
"reminders@odata.type": "#Collection(microsoft.graph.bookingReminder)",
"reminders":
[
{
"message": "Remember your important appointment today",
"offset": "PT120M",
"recipients": "allAttendees"
}
],
"customers":
[
{
"@odata.type": "#microsoft.graph.bookingCustomerInformation",
"name": "Barrington Visitor",
"emailAddress": "visitor@visitor-organisation.org"
}
]
}
This brings a response that looks like this:
{
"error":{
"code": "UnknownError",
"message": "",
"innerError":{
"date": "2022-11-01T15:27:06",
"request-id": "72e0b067-6347-4cb9-9257-04db4765908a",
"client-request-id": "72e0e061-6347-4cb9-9127-0fdb47a590aa"
}
}
}
I have found two known causes of bugs here - if one doesn't include the @odata.type
on the customer
section that will raise an InvalidModel
error with the message changes: Cannot create an abstract class.
Apparently on other endpoints using a timezone other than UTC causes the same UnknownError
message to be raised, but I have switched all my timezones to UTC so I'm hoping that specific cause has been avoided. Something is clearly still a problem, though.
When I look at the request-id in the AAD portal it just shows a successful authentication, no mention of errors being raised subsequently.
Obviously that request is far more minimal than the example in the documentation, so I have gradually gone through and added more and more fields from the object, even ones that seem to be completely unnecessary. Even when the request looks like this, I get the same response:
{
"@odata.type": "#microsoft.graph.bookingAppointment",
"customerTimeZone": "UTC",
"serviceId": "a98309e9-3104-411f-q681-71c7df95a178",
"serviceName": "Appointment Service",
"serviceNotes": "",
"smsNotificationsEnabled": false,
"serviceLocation":
{
"@odata.type": "#microsoft.graph.location",
"address": null,
"coordinates": null,
"displayName": "Online meeting",
"locationEmailAddress": null,
"locationType@odata.type": "#microsoft.graph.locationType",
"locationType": null,
"locationUri": null,
"uniqueId": null,
"uniqueIdType@odata.type": "#microsoft.graph.locationUniqueIdType",
"uniqueIdType": null
},
"startDateTime":
{
"@odata.type": "#microsoft.graph.dateTimeTimeZone",
"dateTime": "2022-12-22T14:30:00+00:00",
"timeZone": "UTC"
},
"endDateTime":
{
"@odata.type": "#microsoft.graph.dateTimeTimeZone",
"dateTime": "2022-12-22T15:00:00+00:00",
"timeZone": "UTC"
},
"duration": "PT30M",
"postBuffer": "PT5M",
"preBuffer": "PT1M",
"price": 0,
"priceType": "free",
"priceType@odata.type": "#microsoft.graph.bookingPriceType",
"staffMemberIds":
[
"e220feb5-5bc-43c6-922z-a2cd5a545ec2"
],
"isLocationOnline": true,
"maximumAttendeesCount": 1,
"filledAttendeesCount": 1,
"reminders@odata.type": "#Collection(microsoft.graph.bookingReminder)",
"reminders":
[
{
"@odata.type": "microsoft.graph.bookingReminder",
"message": "Remember your important appointment today",
"offset": "PT120M",
"recipients@odata.type": "#microsoft.graph.bookingReminderRecipients",
"recipients": "allAttendees"
}
],
"customers@odata.type": "#Collection(microsoft.graph.bookingCustomerInformation)",
"customers":
[
{
"@odata.type": "#microsoft.graph.bookingCustomerInformation",
"name": "Barrington Visitor",
"emailAddress": "visitor@visitor-organisation.org",
"phone": null,
"notes": null,
"location": null,
"timeZone": "UTC",
"customQuestionAnswers": []
}
]
}
This now has all the properties that the documentation example includes, except some of the address
fields are null and there is no location
associated with the customer as I'd have to fabricate one. In both cases adding the fields in question does not resolve the issue.
Has anyone found a way to resolve or even usefully troubleshoot this "UnknownError" message? Alternatively, is there something wrong with my requests that I have missed and would avoid it?