deepakraut
deepakraut

Reputation: 953

JSON Batching not working with some Microsoft Teams API

We are trying the JSON batching of Microsoft Graph using this request:

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

We are able to get a response from /me, but not for /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"
          }
        }
      }
    }
  ]
}

Does batching not support the Teams APIs?

Upvotes: 2

Views: 276

Answers (1)

Bill Bliss - MSFT
Bill Bliss - MSFT

Reputation: 3581

Teams Graph APIs are still in Beta but you're using the /1.0 endpoint. It should work fine on the /beta endpoint.

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

Upvotes: 3

Related Questions