2

The documentation Combine multiple requests in one HTTP call using JSON batching for sequencing requests with the dependsOn property indicates that not all calls in the sequence needs to be dependent, however, when making the following batch call I receive the error:

BadRequest - Batch should be either fully sequential or fully parallel

           'requests': [
                {
                  'id': '1',
                  'method': 'GET',
                  'url': '/me/messages?$top=1'
                },
                {
                  'id': '2',
                  'dependsOn': [ '1' ],
                  'method': 'GET',
                  'url': '/me/calendar/events?$top=1'
                },
                {
                  'id': '3',
                  'method': 'GET',
                  'url': 'me/contacts?$top=1'
                }
          ]
Marc LaFleur
  • 31,987
  • 4
  • 37
  • 63
Julie Turner
  • 141
  • 5
  • Yeah unfortunately the documentation isn't correct. I did see here in known issues it mentions only parallel or serial supported at the moment: https://learn.microsoft.com/en-us/graph/known-issues#simplified-dependencies – Niels Filter Feb 19 '19 at 14:11

1 Answers1

1

You need to add dependsOn to 'id': '3' request too.

Like:

'requests': [
                {
                  'id': '1',
                  'method': 'GET',
                  'url': '/me/messages?$top=1'
                },
                {
                  'id': '2',
                  'dependsOn': [ '1' ],
                  'method': 'GET',
                  'url': '/me/calendar/events?$top=1'
                },
                {
                  'id': '3',
                  'dependsOn': [ '2' ],
                  'method': 'GET',
                  'url': 'me/contacts?$top=1'
                }
          ]
Kepaa
  • 124
  • 13
  • I probably should have been slightly more clear when posting this question. I realize what the answer is, as the error message makes it very clear, what I was more trying to do was indicate that Microsoft's documentation is incorrect as it gives an example that does not have 'dependsOn' on each item in the batch and goes so far as to say that the one without it will execute in parallel. – Julie Turner Mar 16 '18 at 13:18
  • Yep that seems to be the case. There is a mistake in a documentation. – Kepaa Mar 16 '18 at 13:52