Execute an Action through Node-RED

1. Send HTTP request

To execute an action, we need to send a POST HTTP request by using the http request node.

Drag and drop the node into your canvas and configure it as follows

  • HTTP Request Parameters:

Parameter

Value

Method

POST

URL

https://api.iotflows.com/v1/actions/:action_uuid

User authentication

Checked

Type

Basic authentication

Username

Your-Device-Client-ID

Password

Your-Device-Client-Password

2. Receive Action HTTP Request

After the HTTP request has been sent, you can get this request with the IoTFlows action start node.

Drag and Drop node into your canvas

Double-click on the action start node, and then double click on the edit button.

Here we will add the device client that will be used to publish your data.

NOTE: If you have previously configured any nodes with your Client Id and Password, your node should already be configured, if not you need to add your Client Id and Password by clicking the edit button in the Server row

For more information on setting up a client go to Creating a Device Client.

Your device client should now be displayed as your server.

Next, we will click the refresh button in the Topic and select the Action that we will like to execute.

Once everything is complete, click Done.

Connect this node to your device output pins to trigger action.

3.Confirm Action

Every action start node needs to be finished with an action finish node to confirm that the action was properly executed. When an action is triggered with an HTTP request, this will result in an HTTP response code of 200.