JSON批处理不适用于某些Microsoft Teams API

时间:2018-09-12 10:17:20

标签: microsoft-graph microsoft-teams

我们正在使用此请求尝试Microsoft Graph的JSON batching

{
  "requests": [
    {
      "id": "1",
      "method": "GET",
      "url": "/me"
    },
    {
      "id": "2",
      "method": "GET",
      "url": "/me/joinedTeams"
    }
  ]
}

我们能够收到/me的答复,但无法得到/me/joinedTeams的答复:

{
  "responses": [
    {
      "id": "1",
      "status": 200,
      "headers": {
        "Cache-Control": "no-cache",
        "OData-Version": "4.0",
        "Content-Type": "application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false;charset=utf-8"
      },
      "body": {
          // valid response here
      }
    },
    {
      "id": "2",
      "status": 400,
      "body": {
        "error": {
          "code": "BadRequest",
          "message": "Unsupported segment type. ODataQuery: users/35036c48-1e5a-4ca4-89f0-2d11c4cf8937/joinedTeams",
          "innerError": {
            "request-id": "a075c4f6-362a-469f-945b-5b46d96784a0",
            "date": "2018-09-12T10:09:40"
          }
        }
      }
    }
  ]
}

批处理是否不支持Teams API?

1 个答案:

答案 0 :(得分:3)

Teams Graph API仍处于Beta中,但您使用的是/1.0端点。在/beta端点上应该可以正常工作。

POST https://graph.microsoft.com/beta/$batch
Accept: application/json
Content-Type: application/json
{
  "requests": [
    {
      "id": "1",
      "method": "GET",
      "url": "/me"
    },
    {
      "id": "2",
      "method": "GET",
      "url": "/me/joinedTeams"
    }
  ]
}