Rest API
Invoke REST API calls to the external REST server.
Configuration:
Endpoint URL pattern - Can be a static string, or pattern that is resolved using Message Metadata properties. For example
${deviceType}
Request method - GET, POST, PUT, DELETE
Headers - request headers, header or value can be a static string, or pattern that is resolved using Message Metadata properties.
Endpoint URL
URL can be a static string or a pattern. Only Message metadata is used for resolving patterns. So property names that are used in the patterns must exist in the Message Metadata, otherwise raw pattern will be added into URL.
For example, if Message payload contains property deviceType with value container, then this pattern:
http://localhost/api/${deviceType}/update
will be resolved to
http://localhost/api/container/update
Headers
Collection of header name/value can be configured. Those headers will be added into Rest request. Pattern should be used for configured both header name and header value. For example ${deviceType}
. Only Message metadata is used for resolving patterns. So property names that are used in the pattern must exist in the Message Metadata, otherwise raw pattern will be added into header.
Request body - Node will send full Message payload to the configured REST endpoint. If required, Rule Chain can be configured to use chain of Transformation Nodes for sending correct Payload.
Outbound message from this node will contain response status, statusCode, statusReason and responce headers in the Message metadata. Outbound Message payload will be the same as response body. Original Message type and originator will not be changed.
To send a single file as request body, add a field attachments to the message metadata with file uuid stored in DataBase. In that case any message data will be ignored and only file content will be sent. To define a request content type use the header setting like
Content-Type: application/json; charset=UTF-8
Here an example of message metadata to send a single file:
In case of successful request, outbound message will be passed to the next nodes via Success chain, otherwise Failure chain is used.
Sample how to send a Rest API call to Loriot Network server
POST api call for device registration
Last updated