top of page

Tutorial: Set up a REST API on the nodeG5 edge IoT gateway to collect data & parse data in XML format.

TUTORIAL STEPS

We are be going to be running through the following steps:

1.     Set up a REST API response Mocking Rule

2.     Configuring the target device HTTP GET URL, data format & fields with a JSON file

3.     Confirming that the nodeG5 receives data from the target device.

4.     (Optional) Process the data received from devices.

5.     Send the refined device XML data to a designated AWS IoT Core MQTT broker

STEP 1: Setting up the REST API response Mocking Rule.

We will be using a service called Beeceptor which allows you to set up an API response Mocking Rule that provides the following JSON data frame response when it is queried:

XML set beeceptor.png

STEP 2: Configuring the target device HTTP GET URL, data formats & fields in a JSON file

Next the user will also need to upload a JSON "asset" file into the nodeG5 that includes the (i) GET URL, the (ii) list of fields that need to be retrieved at each polling loop & (iii) the format of each of those fields. Here is an example of the JSON file in the URL link below:

URL: https://g5tester.free.beeceptor.com/operation/site3/status

Parse: XML

Example Field: pumpStation.pumps..pump.1.temperature

XML beeceptor response.png

STEP 3: Confirming that the nodeG5 receives data from the target device.

At this point, to confirm that the nodeG5 is receiving data from the target device you can enable a "test mode" to monitor the process within the script in the console.

If the target device (or Beeceptor API mocking service) responds as expected, the data point "25" will be parsed and inserted into the on-board database.

XML parsed data1.png

STEP 4: Process the data received from devices.

You are now ready to directly send the parsed data to the cloud.

Alternatively you can also refine the data with your own custom scripts before sending it by using our Python library.

STEP 5: Send the device data to a designated AWS IoT Core MQTT broker

The nodeG5 comes with integrated cloud SDK client for AWS IoT Core, AWS Sitewise, Azure IoT Central, Azure IoT Hub & Ubidots. There is also a TLS secured MQTT client that will enable you to send to any designated MQTT broker.

In the below example, the data obtained is securely received in AWS IoT Core under "Things". For a more detailed tutorial to set up AWS IoT Core with our gateway, you can see the following link: AWS IoT Core set up.

aws XML receive.png
bottom of page