Forum Discussion

Henry_888's avatar
Henry_888
Copper Contributor
Sep 15, 2023

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 members for the business" step, the API response is

 

here's my sample request :

 

{

    "displayName":"Test",

    "emailAddress""email address removed for privacy reasons",

    "role""externalGuest"

}

 

and I always got this error response even that I've provided name and email address

 

{

    "error": {

        "code""ErrorInvalidOperation",

        "message""Cannot create a booking staff without name and email.",

        "innerError": {

            "date""2023-09-13T09:27:52",

            "request-id""5f90921e-1d45-42c4-ab96-78ff5b6a958b",

            "client-request-id""5f90921e-1d45-42c4-ab96-78ff5b6a958b"

        }

    }

}

 

anyone experience the same issue ?
is there any rules on which email address that can be used as staff member ?

Regards,

 

Henry

5 Replies

  • Ryan_7676's avatar
    Ryan_7676
    Copper Contributor

    Adding the odata.types was the key in getting this to work.  You can find the request format at the link below: 

    https://learn.microsoft.com/en-us/graph/api/bookingbusiness-post-staffmembers?view=graph-rest-1.0&tabs=http#tabpanel_1_http

  • AnthonyLP's avatar
    AnthonyLP
    Brass Contributor

    it's pretty old but the endpoint given by ;icrosoft was not working for me with power automate. 

     

    but if you use this endpoint it's works

     

    https://graph.microsoft.com/beta/bookingBusinesses/id/staffMembers

  • ved-leachim's avatar
    ved-leachim
    Brass Contributor

    Henry_888 

    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's avatar
      ved-leachim
      Brass 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"
      }

       

  • ved-leachim's avatar
    ved-leachim
    Brass Contributor

    I have exactly the same problem. I have already created several new BookingBusiness calendars and tried them with different e-mail addresses (internal and external), but it just doesn't seem to work.

     

    A cross comparison with a calendar created via the GUI has shown that the same fields with the same content work via the GUI, but not via the API.

     

    I would appreciate feedback from Microsoft on this issue.

Resources