cumulocity

How to specify a SmartREST 2.0 template with fragment/series name given by user


How can I define a custom SmartREST 2.0 template which behaves like the pre-defined static template 200 for creating measurements? My goal is that the user can pass the name of fragment and series via MQTT to add generic properties. I can only find documentation/examples for measurement creation where fragment and series are hard coded in the SmartREST template.


Solution

  • SmartREST 2.0 does not provide functionality to set keys as payload parameters. In general I would recommend making SmartREST templates as specific as possible. This saves transfer data volume and makes configuration more granular.

    SmartREST 1.0 provides the functionality you are looking for. It provides full access to the associated JSON structure. Unfortunately this flexibility comes with the downside that it is only available though API and not via user interface. See here: https://cumulocity.com/guides/reference/smartrest/ and here: https://cumulocity.com/guides/device-sdk/mqtt/#smartrest-1