Forum Discussion
Henry_888
Sep 15, 2023Copper Contributor
MS Bookings API - Can't create staff member using MS Bookings API
Hi I'm following this tutorial to use MS Bookings API ( https://learn.microsoft.com/en-us/graph/api/resources/booking-api-overview?view=graph-rest-1.0 ) but I'm stuck in "Add individual staff me...
ved-leachim
Nov 09, 2023Brass Contributor
Hi Henry
I had a call with a member of the Microsoft Graph Team, she could reproduce the issue and it will be escalated within the Graph Team. It looks like the https://learn.microsoft.com/en-us/graph/api/resources/booking-api-overview?view=graph-rest-1.0 and needs to be changed.
The request for the endpoint staffMembers is not sufficient like it is on the documentation at the moment (9.11.23):
POST https://graph.microsoft.com/v1.0/solutions/bookingBusinesses/{id}/staffMembers
Authorization: Bearer {access token}
Content-Type: application/json
{
"displayName":"Dana Swope",
"emailAddress": "email address removed for privacy reasons",
"role": "externalGuest"
}
This will result in the following error response:
{
"error": {
"code": "ErrorInvalidOperation",
"message": "Cannot create a booking staff without name and email.",
"innerError": {
"date": "2023-11-09T16:05:42",
"request-id": "fef2d375-6ff7-4b58-892d-92e7560b98fe",
"client-request-id": "fef2d375-6ff7-4b58-892d-92e7560b98fe"
}
}
}
To workaround this problem you can use the longer Request from the documentation https://learn.microsoft.com/en-us/graph/api/bookingbusiness-post-staffmembers?view=graph-rest-1.0&tabs=http
ved-leachim
Nov 14, 2023Brass Contributor
A minimal valid request would look like that:
{
"@odata.type": "#microsoft.graph.bookingStaffMember",
"displayName": "Hans Muster",
"emailAddress": "email address removed for privacy reasons",
"role": "administrator"
}