Examples

Store JSON into a database

The following task requests information in JSON format from a REST Service and then stores the JSON string into a database. The “GetTags” REST topic is configured as a read-only topic sending GET requests in regular intervals to retrieve data. The JSON response text for each tag is then passed onto the ODBC connector for storage.

../_images/rest-example-1.png

Store numerical data into a database

The following task requests information from a REST Service and stores numerical tag values into a database. The “ServiceTags” REST topic is configured as a read-only topic sending GET requests in regular intervals to retrieve data. The JSON response is parsed to extract the numerical “floatValue”, which is then passed onto the ODBC connector for storage.

../_images/rest-example-2.png

Transfer data from one REST service to another

In this example, float values for three tags are received from a REST service. These values are then encoded back into JSON using the JSON encoders. Because only a single property value (the “floatValue”) is updated, the representative JSON object configured for the encoders contains the “floatValue” property only. The encoded JSON string is then sent to the target REST API service in a PATCH requests for a partial update of the target tag; only the “floatValue” will be updated.

../_images/rest-example-3.png