In our application, when we create a new object via the API, we send SIM and GSM module-related information within the c8y_Mobile
fragment. The object models an embedded device with limited capabilities, so we make use of the HTTPS API directly.
PUT /inventory/managedObjects/myid HTTP/1.1
Host: mytenant.cumulocity.com
Authorization: Basic ....
Content-Type: application/vnd.com.nsn.cumulocity.managedObject+json
Accept: application/vnd.com.nsn.cumulocity.managedObject+json
{
"c8y_Mobile": {
"imei": 1234567890123456,
"imsi": 23456789011234567890,
"iccid": 01234567890123456789
...
}
}
The managed object shows the new fragment as expected:
...
"c8y_IsDevice": {},
"c8y_Mobile": {
"imei": 1234567890123456,
"imsi": 23456789011234567890,
"iccid": 01234567890123456789
...
},
...
When a user changes the SIM card on the embedded unit, IMSI and ICCID properties should be updated within the managedObject c8y_Mobile fragment. But if we send only those properties the whole fragment is overridden:
PUT /inventory/managedObjects/myid HTTP/1.1
Host: mytenant.cumulocity.com
Authorization: Basic ....
Content-Type: application/vnd.com.nsn.cumulocity.managedObject+json
Accept: application/vnd.com.nsn.cumulocity.managedObject+json
{
"c8y_Mobile": {
"imsi": 23456789011234567890,
"iccid": 01234567890123456789
}
}
So the managed object shows this:
...
"c8y_IsDevice": {},
"c8y_Mobile": {
"imsi": 23456789011234567890,
"iccid": 01234567890123456789
},
...
Please note that the imei property and others have been lost and are not longer present in the managed object.
In order to save data and minimise transactions I would like to know if there is a way to update fragments without having to send all the desired properties again.
I've tried to use HTTP POST instead of PUT, but that gives me a method not allowed
error, as stated in the documentation.