Search code examples
microsoft-graph-api

Cannot update customQuestionAnswers in Microsoft Booking with Graph API


How am I supposed to update customQuestionAnswers on a Booking Appointment in the Microsoft Graph API? This is what I've tried:

PATCH https://graph.microsoft.com/v1.0/solutions/bookingBusinesses/<businessId>/appointments/<appointmentId>

{
  "@odata.type": "#microsoft.graph.bookingAppointment",
  "customers": [
    {
      "@odata.type": "#microsoft.graph.bookingCustomerInformation",
      "customerId": "<my-customer-id>",
      "emailAddress": "[email protected]",
      "location": null,
      "name": "Test Testson",
      "notes": "",
      "phone": null,
      "timeZone": null,
      "customQuestionAnswers": [
        {
          "@odata.type": "microsoft.graph.bookingQuestionAnswer",
          "questionId": "9f66cb07-abbc-4427-b3ea-b6a4da80d10d",
          "isRequired": true,
          "selectedOptions": [
            "Video"
          ],
          "question": "Mötestyp",
          "answerOptions": [
            "Video",
            "Telefon"
          ],
          "answerInputType": "radioButton"
        }
      ]
    }
  ]
}

This results in the following error:

{
    "error": {
        "code": "UnknownError",
        "message": "",
        "innerError": {
            "date": "2025-02-11T12:40:27",
            "request-id": "f10492fe-93f6-42b7-8cc4-f675fa705e47",
            "client-request-id": "f713f76d-c962-a2e9-8694-7fafa2f83eb1"
        }
    }
}

Removing the customQuestionAnswers block "solves" the issue.


Solution

  • I think you are missing the answer property for the bookingQuestionAnswer. The value of the answer property cannot be null. It must be at least empty string.

    {
      "@odata.type": "#microsoft.graph.bookingAppointment",
      "customers": [
        {
          "@odata.type": "#microsoft.graph.bookingCustomerInformation",
          "customerId": "<my-customer-id>",
          "emailAddress": "[email protected]",
          "location": null,
          "name": "Test Testson",
          "notes": "",
          "phone": null,
          "timeZone": null,
          "customQuestionAnswers": [
            {
              "@odata.type": "microsoft.graph.bookingQuestionAnswer",
              "questionId": "9f66cb07-abbc-4427-b3ea-b6a4da80d10d",
              "isRequired": true,
              "selectedOptions": [
                "Video"
              ],
              "question": "Mötestyp",
              "answerOptions": [
                "Video",
                "Telefon"
              ],
              "answerInputType": "radioButton",
              "answer": ""
            }
          ]
        }
      ]
    }