代码之家  ›  专栏  ›  技术社区  ›  deepakraut

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

  •  1
  • deepakraut  · 技术社区  · 7 年前

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

    {
      "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"
              }
            }
          }
        }
      ]
    }
    

    批处理不支持团队API吗?

    1 回复  |  直到 7 年前
        1
  •  3
  •   Marc LaFleur    7 年前

    团队图形API仍处于测试阶段,但您正在使用 /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"
        }
      ]
    }
    
    推荐文章