REST Client
8 min
review the following information for setting up and configuring the rest client driver this driver connects to http and https rest api endpoints, allowing you to read and write data using get and post requests you can configure tls, mutual tls, and multiple authentication types including bearer token, digest, and oauth2 compatibility compatibility parameter compatible items driver type ethernet validated devices/series any rest api endpoint accessible over http or https how to configure the plc to set up and configure this device in litmus edge, you will need to do the following step 1 set up and configure the rest api server step 2 set up the device in litmus edge devicehub step 3 configure the list of registers step 1 set up and configure the rest api server ensure your rest api server is accessible from the litmus edge host over the network note the server's hostname or ip address and port number identify the base url path common to all tags you intend to read or write if your server requires authentication, obtain the appropriate credentials none — no credentials required bearer — obtain a bearer token digest — obtain a username and password oauth2 — obtain a client id, client secret, token endpoint, and any required scopes or token parameters if tls is required, obtain the ca certificate chain in pem format if mutual tls (mtls) is required, also obtain the client certificate and client private key in pem format step 2 set up the device in litmus edge devicehub configure the following parameters when you connect a device with this driver update default values to the specific setup of your device connection parameters parameter value type generic driver rest client network address the server's hostname or ip address network port the server's port url path the url path to append to the network address, common to all tag paths authentication type none , bearer , digest , or oauth2 enable tls enable tls/https if an authentication type is selected parameter value username username when digest is selected password password when digest is selected bearer token bearer token value when bearer is selected oauth2client id oauth2 client id when oauth2 is selected oauth2client secret oauth2 client secret when oauth2 is selected oauth2 token endpoint oauth2 token endpoint url when oauth2 is selected oauth2 scopes oauth2 scopes when oauth2 is selected oauth2 token params oauth2 token parameters when oauth2 is selected if tls is enabled parameter value certificate authority ca certificate chain in pem format enable mutual tls enable mtls / client certificate authentication client certificate client certificate in pem format when mtls is enabled client private key client private key in pem format when mtls is enabled advanced parameters parameter value headers common http headers as json path params common http path parameters as json query params common http query parameters as json or parameter string request timeout request timeout in milliseconds request retry count number of times to retry a failed request request retry wait ms pause between retries in milliseconds certificate verification verify the server's tls certificate step 3 configure the list of registers when you add a tag to the connected device, refer to the following tag parameters and available value types free tags this driver doesn't have a list of available register names in the devicehub add tag form to add tags, you must enter the request path for each tag available value types raw , json , string , bool , uint , int , float , string\[] , bool\[] , uint\[] , int\[] , float\[] tag parameters parameter value request type get or post url path request url path to append to the device path path params request http path parameters as json query params request http query parameters as json or parameter string payload request http payload payload encoding request payload format none , formdata , or json advanced tag parameters parameter value headers request http headers as json allow multiple matches when enabled, returns all matches when using wildcards in the parse pattern allow empty matches when enabled, returns an empty array result when using wildcards in the parse pattern