Skip to content

Connect IoT - Rest Client#

This driver allows connection and exchange data using a stateless communication with a Rest Server.

Data Types#

These are the supported specific data types:

Name Description
String String value
Boolean Boolean value
Integer Integer value
Double Double value
DateTime DateTime value
Object Structure value

Table: Rest specific data types

Protocol Parameters#

The protocol supports the following parameters, used to define the communication parameters, as well as the expected behavior of the driver:

Name Type Possible Values Default Value Description
baseUrl string 127.0.0.1 Hostname or IP-Address of the REST server. The host can be a fully qualified domain or IP address. Note: Base URL must not include query string parameters. E.g. api.example.com/v1
port integer 80 Port number of the REST server.
protocol enum HTTP
HTTPS
HTTP Port number of the REST server.
authenticationMode enum None
BasicAuthentication
BearerToken
APIKey
None The authentication mode can be: Basic Authentication (username and password) BearerToken (authentication token e.g. PAT) API Key (api authentication token)
username string Username to use for REST server authentication.
password password Password to use for REST server authentication.
authenticationToken text API-Key or Bearer Token. The bearer token used for REST server authentication. Bearer tokens are sent in the 'Authorization' header of HTTP requests and are prefixed with the word 'Bearer,' e.g., Authorization: Bearer . PATs are supported and are commonly used to authenticate API requests made by scripts, command-line tools, or applications on behalf of a user. An API Key, also known as an Application Programming Interface Key, is a type of security credential used to authenticate and authorize access to web-based services, APIs, or resources.
apiKeyTransmitter enum Header,
Cookie,
QueryParameter,
Header Password to use for REST server authentication.
apiKeyName string Defines an API key name to be sent either as request header, cookie or query parameter. e.g. 'X-API-KEY'
clientCertificate text Own client certificate - can be either a path to a file or the contents of the file in plain text. Format should be 'pem'.
clientPrivateKey text Own client private key - can be either a path to a file or the contents of the file in plain text. Format should be 'pem'.
certificateAuthority text Certificate Authority - can be either a path to a file or the contents of the file in plain text. Format should be 'pem'. The certificateAuthority property is used to define a set of trusted Certificate Authority (CA) certificates that an application or system uses to verify the authenticity of SSL/TLS certificates presented by servers during secure communication. It serves as a trust anchor, allowing the application to establish the legitimacy of certificates in the trust chain presented by the server.
defaultContentType string application/json Default content type the media types consumed by the operation (such as application/json). Request bodies are optional by default. JSON is 'application/json' XML is 'application/xml' Text is 'text/plain' FormData is 'application/x-www-form-urlencoded' Binary is 'multipart/form-data'.

Table: Rest parameters

Extended Parameters#

Command#

All Automation Properties defined in the Driver Definition that use this protocol will have the following extended (extra) attributes available to customize

Name Type Possible Values Default Value Description
requestMethod Enum GET
POST
PUT
DELETE
PATCH
GET HTTP defines a set of request methods to indicate the desired action to be performed for a given resource. Although they can also be nouns, these request methods are sometimes referred to as HTTP verbs. Each of them implements a different semantic, but some common features are shared by a group of them: e.g. a request method can be safe, idempotent, or cacheable.
timeout Integer 30000 Timeout, in milliseconds, where the server fails to send any information.
successfulStatusCodes String 200,201,202 HTTP response status codes indicate whether a specific HTTP request has been successfully completed. List of response status codes that can be accepted as success (use ',' as separator), e.g. '200,201,202'

Command Property#

Name Type Possible Values Default Value Description
operationParameters enum PathParameter
QueryParameter
HeaderParameter
RequestBody
RequestBodyParameter
PathParameter PathParameter: Parameters passed via path (e.g. /users/:id)
QueryParameter: Parameters placed after '?' in the URL (e.g. /users?role=Admin)
HeaderParameter: Parameters sent in the request header (e.g. X-MyHeader: value)
RequestBody: An object representing the request body (e.g. { Id: 1, MaterialName: \"Material01\" })
RequestBodyParameter: Parameters used to build the request body. A RequestBodyParameter will override a request body defined value if they have the same name (e.g. A RequestBodyParameter named 'MaterialName' with value 'Material02' would override 'Material01' if the previous request body was defined)

Table: Rest specific extended properties