使用 json-pointer slack view.publish JSON-encoded 字符串的 http 请求
http request using json-pointer slack view.publish JSON-encoded string
我正在尝试将此 api POST 请求发送到 view.publish 端点 api
如文档所述,我在参数中使用令牌和 user_id,但我不知道我需要对视图参数做什么
我将“application/json;charset=UTF-8”设置为 headers 中的 content-type 和 body 有效负载的 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-encoded 字符串
此警告也显示在 body 选项卡中:
此答案来自 Slack 的支持团队 Aubrey。
不需要参数。
在Authorization选项卡中你需要承担授权。
在 body 上,您需要设置为原始 -> JSON,这将是您的 JSON:
{
"user_id": {{YOUR_USER_ID}},
"view": {
"type": "home",
"blocks": [
{
{{YOUR_PAYLOAD}}
}
]
}
}
它帮助我基于这个 CURL 命令
curl -L -X POST 'https://slack.com/api/views.publish' \
-H 'Content-type: application/json' \
-H 'Authorization: Bearer {{YOUR TOKEN}}' \
--data-raw '{
"user_id": {{YOUR USER ID}},
"view": {
"type": "home",
"blocks": [{
{{YOUR PAYLOAD}}
}]
}
}'
我正在尝试将此 api POST 请求发送到 view.publish 端点 api
如文档所述,我在参数中使用令牌和 user_id,但我不知道我需要对视图参数做什么
我将“application/json;charset=UTF-8”设置为 headers 中的 content-type 和 body 有效负载的 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-encoded 字符串
此警告也显示在 body 选项卡中:
此答案来自 Slack 的支持团队 Aubrey。
不需要参数。 在Authorization选项卡中你需要承担授权。
在 body 上,您需要设置为原始 -> JSON,这将是您的 JSON:
{
"user_id": {{YOUR_USER_ID}},
"view": {
"type": "home",
"blocks": [
{
{{YOUR_PAYLOAD}}
}
]
}
}
它帮助我基于这个 CURL 命令
curl -L -X POST 'https://slack.com/api/views.publish' \
-H 'Content-type: application/json' \
-H 'Authorization: Bearer {{YOUR TOKEN}}' \
--data-raw '{
"user_id": {{YOUR USER ID}},
"view": {
"type": "home",
"blocks": [{
{{YOUR PAYLOAD}}
}]
}
}'