FORUM CTRLX AUTOMATION
ctrlX World Partner Apps for ctrlX AUTOMATION
09-08-2021 08:19 PM
I'm trying to command a GET request to the ctrlX System API, using Node Red. I'm trying to read the tempCpu variable.
Working: issuing command from localhost, ie: Node Red running on the same CORE where I am directing the GET request. You can see the flow and the result in the working.png picture and FlowWorking.txt files attached.
Not Working: issuing the same command from a different device, trying to issue the GET request to the other CORE IP address.
For the GET request, I get this error:
"Error: error:0909006C:PEM routines:get_name:no start line : https://192.168.1.10/system/api/v1/sensors/tempCpu"
I tried a variety of different ways of using certificates, keys and tokens to get the command to work, but none have worked. I used the certificates and keys, in various combinations from the "Web Server" section of certificates and keys on the CORE, of whose temperature I would like to read.
I looked at the documentation on the REST API that described obtaining the bearer token. I tried this in YARC and it works fine. The same POST command from Node Red also returns a similiar error such as this one:
"Error: error:0909006C:PEM routines:get_name:no start line : https://192.168.1.10/identity-manager/api/v1/auth/token"
I have seen Node Red examples elsewhere for data layer, but nothing for the APIs, like the System API.
I'm out of ideas...any advice or code examples of how to do this?
Solved! Go to Solution.
09-09-2021 09:02 AM - edited 09-09-2021 09:03 AM
var newMsg = {};
newMsg.header = {};
newMsg.header["Content-Type"] = "application/json"
newMsg.payload =
{name: boschrexroth, password: boschrexroth}
newMsg.url = "https://192.168.1.2/identity-manager/api/v1/auth/token";
return newMsg;
09-09-2021 02:54 PM
To answer your questions:
1. The ctrlX contribution nodes seem to be only for the data layer. I am trying to use the System API. I tried this anyway, to be sure, but the reads failed in a couple of different configurations:
2. I tried your suggestion but I get an error I was also getting before. I did not mention it, but I had this error when trying to use the certificate settings in the Node Red HTML node:
I must admit that I am not very knowledgable (yet) on REST API authentication and when to use certificates, keys, tokens, etc. This test is my effort to learn about it more.
09-09-2021 04:29 PM
I just tested the way described by me again in an new set up ubuntu and everything works fine.
Please send me a private message with your contact data then I can have a look to your application.