7.2.6.1 The REST TRANSACT statement

The REST TRANSACT statement sends a REST HTTP request to the device, either with or without a JSON formatted document body. It retrieves the device's reply and parses the document body into an object tree.

images/rest-ta1-statement.png

The request is an arbitrary long sequence of quoted strings and sat-nms variables. Strings and variable content are concatenated to build the request string:

images/rest-ta3-statement.gif

The request must start with the HTTP method to execute (one of GET, PUT, POST, PATCH or DELETE), followed by one space character and the path of the URL to read. The path may contain URL parameters. Example:

GET /api/v1/settings/modulator?slot=2

Please note, that no URL-encoding is done on this string, this means that all special character must be escaped (e.g. blanc replaced by '+')

With the POST, PUT or PATCH HTTP methods, REST TRANSACT sends the JSON document actually in memory to the device. This document may be created from scratch or the recent reply from the device may be used as a template which is modified before the transaction is executed. To transact a HTTP method other than GET without sending a JSON document, place a REST CLEAR statement directly above the REST TRANSACT.

REST TRANSACT may be immediately followed by the keyword CONTENTTYPE and a content type definition in double quotes or contained in a variable. This content type definition overrides any PROTOCOLPARAMETER post.content.type=... definition made in the protocol or driver header.