Create routes
Create routes to capture inbound messages and add actions to perform various actions.
Prerequisites:
- Activate a group in Trimble IoT using the Groups API.
- Activate a device in Trimble IoT using the Devices API.
Create a route using the Route API.
Configure Data Ocean action
Messages captured in a route can be uploaded to a Data Ocean directory as files. This can be done by adding aData Ocean action.
To configure Data Ocean action:
-
Create a directory in Data Ocean and provide write permissions to the below IoT application using ACL using the Create Directory API.
Stage : IoT Application - ApplicationId : 2642d8bb-04f3-47d6-b367-8b4ea2374fee
Production: IoT Application - ApplicationId : 957483ec-62e2-41ad-8aa9-5861be08b4fd -
Create or update a route with Data Ocean action. Refer to the Route API.
Request
"dataocean": {"bufferSeconds": 60,"directoryId": "28233f73-eb79-4411-aaea-9b33691217a0"}Response
"dataocean": {"path": "7ecbd2a4-9ab9-4085-be24-ce80c0279cbd:/messages","directoryId": "28233f73-eb79-4411-aaea-9b33691217a0","bufferSeconds": 60} -
Send inbound messages to the topic defined in the route. Messages will be captured every given bufferSeconds interval and uploaded as files. The files will be uploaded to the following directory format {Year}/{Month}/{Date}/{Hour}/ (Eg: 2023/06/23/10).
-
Use the List files in a directory API to get the files. Append the path from the response and the directory format mentioned in the above step to get the file path. (Example: 7ecbd2a4-9ab9-4085-be24-ce80c0279cbd:/messages/2023/06/23/10).