批处理:使用dependsOn属性对请求进行排序

时间:2018-03-14 18:20:12

标签: microsoft-graph microsoft-graph-batch

带有dependsOn属性的排序请求的文档Combine multiple requests in one HTTP call using JSON batching表示序列中的所有调用都不需要依赖,但是,在进行以下批量调用时,我收到错误:

BadRequest - 批处理应该是完全顺序的或完全并行的

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

1 个答案:

答案 0 :(得分:1)

您需要将dependsOn添加到' id':' 3'要求也是。

像:

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