How to fetch fieldname and structure for additional properties in operation, managedObject etc

88 views Asked by At

I am trying to figure out which fragments are related to operation:

  • managedObject
  • event
  • measurement
  • alarm

So , Is there a way to get all these fragments ?

Also there are additional Properties for which field name is defined as * and the value can be an Object or anything else(*). I have gone through the device management library and sensor library in cumulocity documentation but found it does not contain all the possible fragments and there is no clarity as in which object the fragment goes i.e does it go in operation or managedObject, or both?

1

There are 1 answers

0
André On

Since every user, device and application can contribute such fragments, there is no "global list" of them that you could refer to. Normally, a client (application, device) knows what data it sends or what data it requests, so it's also in most cases not required.

Regarding the relationship between operations and managed objects, there are some typical design pattern. Let's say you want to configure something in a device, like a polling interval:

"mydevice_Configuration": { "pollingRate": 60 }

What your application would do is to send that fragment as an operation to a device:

POST /devicecontrol/operations HTTP/1.1
...
{
   "deviceId": "12345",
   "mydevice_Configuration": { "pollingRate": 60 }
}

The device would accept the operation (http://cumulocity.com/guides/rest/device-integration/#step-6-finish-operations-and-subscribe) and change its configuration. When it does that successfully, it will update its managed object to contain the new configuration:

PUT /inventory/managedObjects/12345 HTTP/1.1
{
   "mydevice_Configuration": { "pollingRate": 60 }
}

This way, your inventory reflects as closely as possible the true state of devices.

Hope that helps ...