Example 5 – Create thing with custom master data association
The following request payload creates a thing along with custom master data association.
{
"_externalId": " ABCXSeries001",
"_name": " ABCXSeries",
"_description": {
"en": " Car Model ABC xSeries 001"
},
"_thingType": [
" core.automobiles:ABCXSeries"
],
"_objectGroup": " 473BB1AFC4A4415791543C3F2CFDD295",
"customDataAssociation": [
{
"AssociatedObjectID": "FrontRWheel",
"AssociatedEntity": "core.automobiles:Wheel",
"Relationship": "HAS A",
"Descriptions": [
{
"LanguageCode": "en",
"Description": "Association between Thing ABCXSeries and FrontRWheel"
}
],
"StartTime": "2018-05-17T13:00:56.229Z",
"ExpiryTime": "2018-06-17T12:00:56.229Z"
},
{
"AssociatedObjectID": "RearRWheel",
"AssociatedEntity": "core.automobiles:Wheel",
"Relationship": "HAS A",
"StartTime": "2018-05-17T13:00:56.229Z",
"ExpiryTime": "2018-06-17T12:00:56.229Z"
},
{
"AssociatedObjectID": "RearLWheel",
"AssociatedEntity": "core.automobiles:Wheel",
"Relationship": "HAS A",
"Descriptions": [
{
"LanguageCode": "en",
"Description": " Association between Thing ABCXSeries and RearLWheel"
}
],
"StartTime": "2018-05-17T13:00:56.229Z",
"ExpiryTime": "2018-06-17T12:00:56.229Z"
}
]
}
From the given request payload, you can infer the following:
-
Thing type core.automobiles:ABCXSeries is already associated with the object type core.automobiles:Wheel. The association type is onetomany and the relationship is HAS A.
-
Object instances FrontRWheel and RearRWheel are already created for the object type core.automobiles:Wheel. Note that you must provide the auto generated GUID for the object instances.
-
The new thing instance is created and associated with the object instances FrontRWheel and RearRWheel.