【发布时间】:2021-07-21 01:01:10
【问题描述】:
我正在尝试将此 api POST 请求发送到 slack api 上的 view.publish 端点
正如文档所解释的,我在参数中使用令牌和 user_id,但我不知道我需要对视图参数做什么
我在标题中将“application/json;charset=UTF-8”设置为内容类型,并在正文中设置我要发布的有效负载的 JSON:
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "This is a section block with a button."
},
"accessory": {
"type": "button",
"text": {
"type": "plain_text",
"text": "Click Me",
"emoji": true
},
"value": "click_me_123",
"url": "http://scoreboard-azureslackbot-salvosoftware.s3-website.us-east-2.amazonaws.com/",
"action_id": "button-action"
}
}
]
}
当我进行 api 调用时显示此错误:
{
"ok": false,
"error": "invalid_arguments",
"response_metadata": {
"messages": [
"[ERROR] failed to match all allowed schemas [json-pointer:/view]",
"[ERROR] must provide an object [json-pointer:/view]",
"[ERROR] must provide an object [json-pointer:/view]"
]
}
}
文档说视图必须是 JSON 编码的字符串
此警告也会显示在正文选项卡中:
【问题讨论】:
-
去掉你手动添加的内容hehader,postman自动添加