Connect Proxmox Backup Server (PBS) using API calls


The first step is obtaining the ticket. In Postman I can manage using the following:

Then set the cookie in the get request

And I'm able to get the required info.

How to do this in Node-RED?


Export your 2 queries as CURL and I will show you the "node-red" way using requests.


Feel free to sanitise any data (like username/password)

It seems that I can simplify this by creating an API token. The curl command will then be:

curl -H "Authorization: PBSAPIToken=root@pam!monitoring:xxx"

Coverting to JSON I will get:

    "url": "",
    "raw_url": "",
    "method": "get",
    "headers": {
        "Authorization": "PBSAPIToken=root@pam!monitoring:xxx"

And above is working in Postman.

Like to see how to achieve this in Node-RED.


Try this...

Demo flow (use CTRL+I to import)...

[{"id":"c82b311ec0638ce1","type":"http request","z":"4c5ad8c7caa80822","name":"","method":"use","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"","senderr":false,"headers":[],"credentials":{"user":"","password":""},"x":440,"y":1160,"wires":[["92e61560bb618ec1"]]},{"id":"fe26ba8d9d76aca4","type":"function","z":"4c5ad8c7caa80822","name":"","func":"//original curl:  \n//\n//curl -H \"Authorization: PBSAPIToken=root@pam!monitoring:xxx\"\n\nmsg.method = \"get\";\nmsg.url = \"\";\nmsg.payload = ``;\nmsg.headers = {\n    \"Authorization\": \"PBSAPIToken=root@pam!monitoring:xxx\"\n};\nmsg.cookies = null;\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":260,"y":1160,"wires":[["c82b311ec0638ce1"]]},{"id":"92e61560bb618ec1","type":"debug","z":"4c5ad8c7caa80822","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":620,"y":1160,"wires":[]},{"id":"2fde920d638097d0","type":"inject","z":"4c5ad8c7caa80822","name":"Click me","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":80,"y":1160,"wires":[["fe26ba8d9d76aca4"]]}]

I will get:

"RequestError: self signed certificate :"


The error is quite self-explanatory... You are attempting an HTTPS request to an IP address and there is no valid certificate. So it fails.

If you look in the manual of the HTTP node:

If set to false, allows requests to be made to https sites that use self signed certificates.

In the function where msg.url and so on are set, adding a line:

msg.rejectUnauthorized = false;

should do the trick.

Thnx, I had a look before at this but the post I found had a slightly different solution that did not do the job.

Thanks a lot for your help. It turned out that I should not use the HTTP nodes but just write a function.


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.