无法通过 REST API 将 ERPNext 与 Node-RED 连接

问题描述 投票:0回答:0

我正在尝试通过 REST API 与 Node-RED 上的 ERPNext 建立连接,但在 Node-RED 中我收到“服务器无响应”。我正在使用的 Node-RED Flow:

我的功能节点:

我的http响应节点:

我的 ERPNext 和 Node-RED 都在同一个网桥下的 Docker 上运行。我使用的 IP 地址是 ERPNext Docker 容器的 IP 地址。

我运行ERPNext和Node-RED的端口分别是8000和1880。

Node-RED调试的错误是:

{“_msgid”:“c3f7ab18.91e928”,“有效负载”:“错误:ETIMEDOUT: http://172.19.0.8:8000/api/resource/Item","topic":"","method":"GET","headers":{"Authorization":"token f5a1ab34ac4db01:bb0516b2d3c1016","Accept":"application/json","Content-Type":"application/json"},"url":"http://172.19.0.8:8000/api/resource/Item", “statusCode”:“ETIMEDOUT”}

我试过在 Node-RED 上使用 localhost:8000 但没有用。我试过在 Python 中使用同样的东西。它在 python 中工作,但是如图所示:

VSCode中用于REST连接的代码:

GET http://localhost:8000/api/resource/Item
Authorization: token f5a1ab34ac4db01:bb0516b2d3c1016

VSCode 尝试 REST 连接的输出:

HTTP/1.1 200 OK
Content-Length: 25
Content-Type: application/json
Date: Mon, 13 Mar 2023 17:12:37 GMT
Server: nginx/1.21.6
Set-Cookie: sid=Guest; Expires=Thu, 16-Mar-2023 17:12:37 GMT; Path=/,system_user=yes; Path=/,full_name=Guest; Path=/,user_id=Guest; Path=/,user_image=; Path=/
Strict-Transport-Security: max-age=63072000; includeSubDomains; preload
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 1; mode=block
Connection: close

{
  "data": [
    {
      "name": "001"
    }
  ]
}

我希望它与 Node-RED 一起工作,它应该。我只是卡住了。非常感谢帮助。

docker rest containers node-red erpnext
© www.soinside.com 2019 - 2024. All rights reserved.