Sending private key via API calls - /flow

I have private key saved in node red. But not able to select the same using API /flow.
Please let me know how can we input the private key via API calls.


It really isn't clear what you are asking here. Please explain in more detail exactly what you are trying to do.

Is this a private key relating to the Projects feature for pushing to a remote Git repository?

Or something else e.g. uploading a certificate/private key for a TLS connection?



So I'm using the "IoT Telemetry Send" node where I have to provide RSA Private Key as one of the device properties.

Please see the below screenshot, where private key can be saved and selected from the dropdown list

I exported the created flow where this node is used and on importing the same the Private Key is not selected by default and I have to select from the list every time after import.

I'm using API /flow method to import the flow to our node red instance.

So I need inputs on how to set a private key via API without having to manually select it every time.

In the payload I tried providing the private key name as "privateKey": "abc" . But it doesn't help and I have to manually select it every time after an import.

Getting the below error "Invalid Properties: - privateKey"

The private key is a config node. Config nodes can be scoped to the tab or globally (default) so they are stored out side the nodes of a give tab (flow).

How did you export the flow? Mouse select and export or export whole tab or export all tabs?

Also it's very likely that the private key config node is storing it's actual value as a credential, so even if the config node is exported it will not actually hold the private key. it will not be accessible when you export it as credentials are never returned to the browser in any way.

The privateKey value will need to be a node id as it points to a config node.


Thanks for getting back.
Below is code snippet I'm using in the /flow API for setting the private key. But this is not working

                    # "id": "77ac4a51.6b6ab4",
                    "type": "google-cloud-private-key",
                    "name": "PER_TEST",
                    "credentials": [
                            "privateKey": data

I'm storing and passing the private key in variable "data".

Without spending time looking at the source code for the nodes in question it's hard to say anything useful here, but I will guess that the credentials field should not be an array (remove the [ and ] from the example.)

Also please use the toolbar to format code properly it will make it a lot easier for everybody to read.

Thanks you so much. It actually worked after removing [ and ] as suggested.

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