Search code examples
microsoft-graph-apimicrosoft-graph-plannertasks

Patch Planner Tasks Details Error - Bad request with Base-64 string Error


I am trying to call https://graph.microsoft.com/v1.0/planner/tasks/{{taskId}}/details with this request:

{
    "checklist": {
        "552f6163-e7d3-4e31-9015-577b0e6cc997": {
            "@odata.type": "microsoft.graph.plannerChecklistItem",
            "title": "Update task details",
            "isChecked": false
        }
    }
}

I have the if-match header set properly, with the etag from the tasks. I get the below 400 Bad Request response when I run the query:

{
    "error": {
        "code": "",
        "message": "The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters. ",
        "innerError": {
            "request-id": "c9781050-e409-4b88-9d7e-0a57dcec1f82",
            "date": "2020-05-29T21:26:17"
        }
    }
}

I have tried random GUIDs, and base-64 encoded strings, to no avail. I also tried to download the Postman Environment, but I get the same error from there. Any help or guidance would be hugely appreciated.

Thanks for your time. B.


Solution

  • You are getting this error because the If-Match header has an invalid value. When viewed by tools, sometimes tools include escape characters, which needs to be adjusted when making queries manually through Graph Explorer or Postman. Correct If-Match header value looks like:

    W/"Base64EncodedStuff"
    

    Aside from that issue, your query appears correct.