MS团队使用JSON批处理请求在通道中发布消息来绘制API

MS团队使用JSON批处理请求在通道中发布消息来绘制API,json,rest,microsoft-graph-api,microsoft-teams,microsoft-graph-teams,Json,Rest,Microsoft Graph Api,Microsoft Teams,Microsoft Graph Teams,我正在尝试使用JSON批处理将多个请求合并到一个HTTP调用中,以使用GRAPH Explorer在MS Teams通道中发布消息 url=https://graph.microsoft.com/beta/$batch Request Body ={ "requests": [ { "id": "1", "url": "/teams/cf82621f-bbe1-4bf1-a973-030fc6e58f03/channels/19:832f5e8d49ad4bfe96944

我正在尝试使用JSON批处理将多个请求合并到一个HTTP调用中,以使用GRAPH Explorer在MS Teams通道中发布消息

url=https://graph.microsoft.com/beta/$batch
Request Body ={
"requests": [
  {
    "id": "1",
      "url": "/teams/cf82621f-bbe1-4bf1-a973-030fc6e58f03/channels/19:832f5e8d49ad4bfe96944d47cdd921d2@thread.skype/messages",
    "method": "POST",

    "body": {
  "content": "HelloWorld"
},"headers": {
      "Content-Type": "application/json"
    }

  }

]
}
发布后,我获得了成功-状态代码200,但响应如下

{
    "responses": [
        {
            "id": "1",
            "status": 400,
            "body": {
                "error": {
                    "code": "BadRequest",
                    "message": "Value cannot be null.\r\nParameter name: Content",
                    "innerError": {
                        "request-id": "e23a0012-f40b-45e8-bae8-d68204217921",
                        "date": "2019-12-04T13:23:16"
                    }
                }
            }
        }
    ]
}

我在正文中提到了内容的价值,没有JSON批处理,它对我来说很好。

你能试试下面给出的JSON吗?您需要发送两个body属性,一个是批处理请求,另一个是团队端点的实际负载

"requests": [
  {
    "id": "1",
    "url": "/teams/cf82621f-bbe1-4bf1-a973-030fc6e58f03/channels/19:832f5e8d49ad4bfe96944d47cdd921d2@thread.skype/messages",
    "method": "POST",
    "body": {
      "body": {
        "content": "Hello World"
      }
    },
    "headers": {
      "Content-Type": "application/json"
    }
  }
]
}

明亮的它起作用了,我正在努力@Vikrant Singh