0

I am trying to delete Planner task using Microsoft graph according to instruction on https://learn.microsoft.com/en-us/graph/api/plannertask-delete?view=graph-rest-1.0&tabs=http

GET works, DELETE does not.

Request should look like:

DELETE https://graph.microsoft.com/v1.0/planner/tasks/{id}
If-Match: W/"JzEtVGFzayAgQEBAQEBAQEBAQEBAQEBAWCc="

In my case, it is:

DELETE https://graph.microsoft.com/v1.0/planner/tasks/nWf2j63qnk69r69ZdK7135cAMVlSIf-Match:W/"JzEtVGFzayAgQEBAQEBAQEBAQEBAQEBAWCc="

What am I doing wrong?

GET
https://graph.microsoft.com/v1.0/planner/tasks/nWf2j63qnk69r69ZdK7135cAMVlS

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#planner/tasks/$entity",
    "@odata.etag": "W/\"JzEtVGFzayAgQEBAQEBAQEBAQEBAQEBAWCc=\"",
    ...
    "id": "nWf2j63qnk69r69ZdK7135cAMVlS",
    ...


{
    "error": {
        "code": "BadRequest",
        "message": "Resource not found for the segment '\"JzEtVGFzayAgQEBAQEBAQEBAQEBAQEBAWCc=\"'.",
        "innerError": {
            "request-id": "58d3c417-6474-422c-912d-e6fdaae856c3",
            "date": "2019-09-06T23:47:35"
        }
    }
}
Gene Z. Ragan
  • 2,643
  • 2
  • 31
  • 41

1 Answers1

1

It appears you are trying to pass If-Match via request url:

DELETE https://graph.microsoft.com/v1.0/planner/tasks/nWf2j63qnk69r69ZdK7135cAMVlSIf-Match:W/"JzEtVGFzayAgQEBAQEBAQEBAQEBAQEBAWCc="
                                                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

while it is expected to be provided via request headers, like this:

DELETE https://graph.microsoft.com/v1.0/planner/tasks/{id}
Headers: 
   If-Match: W/"JzEtVGFzayAgQEBAQEBAQEBAQEBAQEBAWCc="
   Authorization: Bearer <access-token>

Graph Explorer example

enter image description here

Vadim Gremyachev
  • 57,952
  • 20
  • 129
  • 193