【问题标题】:Why in node-red my HTTP POST no receive payload from inject?为什么在 node-red 中我的 HTTP POST 没有接收来自注入的有效负载?
【发布时间】:2023-03-26 05:06:01
【问题描述】:

我尝试使用 https://rpinotify.it/invio-di-testo.html 我想用 http post 发送消息,但我不能,请看图片

我使用 Node-Red 到 fred.sensetecnic,我尝试使用 json、字符串...我无法解开,你能帮帮我吗?

3/7/2018, 08:43:15node: 9ee1f8ea.e1c5b8
msg.payload : Object
object
text: "testo"
3/7/2018, 08:43:15node: 9ee1f8ea.e1c5b8
msg.payload : Object
object
info: object
datetime: "2018-07-03 06:43:15"
ip: "54.149.86.44, 108.162.246.239"
message: "'text' or 'img' POST parameter are required"
response: 400

[
    {
        "id": "e6ce432b.5361",
        "type": "tab",
        "label": "Flow 2",
        "disabled": false,
        "info": ""
    },
    {
        "id": "1b6aa9ad.127af6",
        "type": "inject",
        "z": "e6ce432b.5361",
        "name": "",
        "topic": "",
        "payload": "{\"text\":\"testo\"}",
        "payloadType": "json",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 130,
        "y": 420,
        "wires": [
            [
                "18f17e07.1a0c42",
                "9ee1f8ea.e1c5b8"
            ]
        ]
    },
    {
        "id": "18f17e07.1a0c42",
        "type": "http request",
        "z": "e6ce432b.5361",
        "name": "",
        "method": "POST",
        "ret": "obj",
        "url": "https://api.rpinotify.it/message/xxx__secret_key__xxx/",
        "tls": "",
        "x": 370,
        "y": 480,
        "wires": [
            [
                "9ee1f8ea.e1c5b8"
            ]
        ]
    },
    {
        "id": "9ee1f8ea.e1c5b8",
        "type": "debug",
        "z": "e6ce432b.5361",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "x": 550,
        "y": 380,
        "wires": []
    }
]

【问题讨论】:

  • 什么图片?请使用调试侧边栏的屏幕截图更新您的帖子,显示您的有效负载已展开,以便我们可以看到您发送的数据的结构。了解您尝试使用的节点也将有所帮助——您提到了“http post”,但 RpiNotify 网站说它使用电报。

标签: node-red


【解决方案1】:

如果您发送的 msg.payload 为 {},这是一个空对象。

错误是说您需要在对象中有一个textimg 字段(具有合理的值)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-02-12
    • 1970-01-01
    • 1970-01-01
    • 2019-03-10
    • 2015-04-29
    • 1970-01-01
    相关资源
    最近更新 更多