0

我正在尝试根据https://docs.microsoft.com/en-us/graph/api/plannertask-delete?view=graph-rest-1.0&tabs=http上的说明使用 Microsoft graph 删除 Planner 任务

GET 有效,DELETE 无效。

请求应如下所示:

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

就我而言,它是:

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

我究竟做错了什么?

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"
        }
    }
}
4

1 回答 1

1

您似乎正在尝试If-Match通过请求 url 传递:

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

虽然预计将通过请求标头提供,如下所示:

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

图形资源管理器示例

在此处输入图像描述

于 2019-09-09T09:24:13.050 回答