MS Teams Graph API 使用 JSON BATCH 请求到频道中的 post 消息
MS Teams Graph API using JSON BATCH request to post message in channel
我正在尝试使用 GRAPH Explorer 使用 JSON 批处理将多个请求合并到 MS Teams 频道中的 post 消息中。
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"
}
}
]
}
在 post 上,我获得了成功 - 状态代码 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 吗?您需要发送两个正文属性,一个是批处理请求,另一个是用于团队端点的实际负载。
"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"
}
}
]
}
我正在尝试使用 GRAPH Explorer 使用 JSON 批处理将多个请求合并到 MS Teams 频道中的 post 消息中。
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"
}
}
]
}
在 post 上,我获得了成功 - 状态代码 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 吗?您需要发送两个正文属性,一个是批处理请求,另一个是用于团队端点的实际负载。
"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"
}
}
]
}