Updating the Array Attributes
The Oracle Communications Unified Inventory Management (UIM) REST API allows you to update multiple attributes in the form of an array. You can update the array attributes using either Merge Patch or JSON Patch. However, there are certain specifications you need to consider while using JSON Patch for updating the array attributes. The specifications are:
-
You can only perform ADD, REMOVE, and REPLACE operations using JSON Patch.
-
Use ADD operation if the attribute values are NULL. Use REPLACE and REMOVE operations on all values other than NULL.
-
The path in JSON Patch format should always start with '/'.
-
You must use a filter query for patch operations on array attributes.
-
The Multiple-party association is not supported with JSON Patch.
-
To maintain the accuracy of data, the following specific paths are supported:
Array Attribute | Supported Paths |
---|---|
resourceCharacteristic
|
/resourceCharacteristic/value |
resourceRelationship
|
/resourceRelationship (use this path only to add a new relationship) /resourceRelationship/resourceRef /resourceRelationship/fromRole /resourceRelationship/toRole |
place
|
/place |
relatedParty
|
/relatedParty |
roles
|
/roles |
Merge Patch for Resource Characteristics
Example of Request Body
The following example shows the request body for updating resource characteristics of a Physical Device in Merge Patch format.
{ "@type": "PhysicalDevice", "name": "BAT_PD_Updated", "resourceCharacteristic": [ { "name": "BATMODEL", "valueType": "ALPHANUMERIC", "value": "Model223DA" } ] }
Example of Response Body
The following example shows the contents of the response body in Merge Patch format.
{ "id": "4-1", "href": "http://hostname:port/InventoryRSOpenAPI/resourceInventoryManagement/version/resource/4-1", "@type": "PhysicalDevice", "@baseType": "PhysicalResource", "name": "BAT_PD_Updated", "version": "1", "lifecycleState": "INSTALLED", "lifecycleSubState": "UNASSIGNED", "startDate": "2020-10-01T19:53:55.141Z", "endDate": "2038-01-19T08:44:07.000Z", "resourceCharacteristic": [ { "name": "BATMODEL", "valueType": "ALPHANUMERIC", "value": "Model223DA" } ], "resourceSpecification": { "id": "BATPhysicalDeviceSpec", "href": "http://hostname:port/InventoryRSOpenAPI/specification/BATPhysicalDeviceSpec", "name": "BATPhysicalDeviceSpec", "version": "1", "entityType": "PhysicalDevice", "startDate": "2020-09-30T00:00:01.000Z", "endDate": "2038-01-19T08:44:07.000Z" }, "physicalConnectors": " http://hostname:port/InventoryRSOpenAPI/resourceInventoryManagement/version/physicalDevice/4-1/physicalConnectors", "physicalPorts": " http://hostname:port/InventoryRSOpenAPI/resourceInventoryManagement/version/physicalDevice/4-1/physicalPorts" }
Merge Patch for Resource Relationships
Example of Request Body
The following example shows the request body for updating resource relationships of a Physical Device in Merge Patch format.
{ "@type": "PhysicalDevice", "name": "BAT_PD_Updated", "resourceRelationship": [ { "type": "MAPPEDTO", "resourceRef": { "id": "1-75001", "@type": "LogicalDevice" } } ] }
Example of Response Body
The following example shows the contents of the response body in Merge Patch format.
{ "id": "4-1", "href": "http://hostname:port/InventoryRSOpenAPI/resourceInventoryManagement/version/resource/4-1", "@type": "PhysicalDevice", "@baseType": "PhysicalResource", "name": "BAT_PD_Updated", "version": "1", "lifecycleState": "INSTALLED", "lifecycleSubState": "UNASSIGNED", "startDate": "2020-10-01T19:53:55.141Z", "endDate": "2038-01-19T08:44:07.000Z", "resourceRelationship": [ { "type": "MAPPEDTO", "resourceRef": { "id": "1-75001", "href": "http://hostname:port/InventoryRSOpenAPI/resourceInventoryManagement/version/resource/1-75001", "@type": "LogicalDevice" } } ], "resourceCharacteristic": [ { "name": "BATMODEL", "valueType": "ALPHANUMERIC", "value": "Model223DA" } ], "resourceSpecification": { "id": "BATPhysicalDeviceSpec", "href": "http://hostname:port/InventoryRSOpenAPI/specification/BATPhysicalDeviceSpec", "name": "BATPhysicalDeviceSpec", "version": "1", "entityType": "PhysicalDevice", "startDate": "2020-09-30T00:00:01.000Z", "endDate": "2038-01-19T08:44:07.000Z" }, "physicalConnectors": "http://hostname:port/InventoryRSOpenAPI/resourceInventoryManagement/v2/physicalDevice/4-1/physicalConnectors", "physicalPorts": "http://hostname:port/InventoryRSOpenAPI/resourceInventoryManagement/v2/physicalDevice/4-1/physicalPorts" }
Merge Patch for Related Party
Example of Request Body
The following example shows the request body for updating the related parties of a Physical Device in Merge Patch format.
{ "@type": "CustomObject", "name": "BAT_CO", "relatedParty": [ { "id": "1", "href": "http://localhost:7026/InventoryRSOpenAPI/party/1", "name": "BATParty", "@referredType": "Party" } ] }
Example of Response Body
The following example shows the contents of the response body in Merge Patch format.
{ "id": "12-1", "href": "http://hostname:port/InventoryRSOpenAPI/resourceInventoryManagement/version/resource/12-1", "@type": "CustomObject", "@baseType": "LogicalResource", "name": "BAT_CO", "version": "1", "lifecycleState": "INSTALLED", "lifecycleSubState": "UNASSIGNED", "startDate": "2020-09-29T19:38:38.187Z", "endDate": "2038-01-19T08:44:07.000Z", "resourceSpecification": { "id": "BATCOSpec", "href": "http://hostname:port/InventoryRSOpenAPI/specification/BATCOSpec", "name": "BATCOSpec", "version": "1", "entityType": "CustomObject", "startDate": "2020-09-30T00:00:01.000Z", "endDate": "2038-01-19T08:44:07.000Z" }, "relatedParty": [ { "id": "1", "href": "http://hostname:port/InventoryRSOpenAPI/party/1", "name": "BATParty", "@referredType": "Party" } ] }
Merge Patch for Place
Example of Request Body
The following example shows the request body for updating the place of a Physical Device in Merge Patch format.
{ "@type": "PhysicalDevice", "name": "BAT_PD", "place": [ { "id": "1", "name": "BATLocation", "@referredType": "GeographicLocation" } ] }
Example of Response Body
The following example shows the contents of the response body in Merge Patch format.
{ "id": "4-1", "href": "http://hostname:port/InventoryRSOpenAPI/resourceInventoryManagement/version/resource/4-1", "@type": "PhysicalDevice", "@baseType": "PhysicalResource", "name": "BAT_PD", "version": "1", "lifecycleState": "INSTALLED", "lifecycleSubState": "UNASSIGNED", "startDate": "2020-10-01T19:53:55.141Z", "endDate": "2038-01-19T08:44:07.000Z", "resourceCharacteristic": [ { "name": "BATMODEL", "valueType": "ALPHANUMERIC", "value": "Model223DA" } ], "resourceSpecification": { "id": "BATPhysicalDeviceSpec", "href": "http://hostname:port/InventoryRSOpenAPI/specification/BATPhysicalDeviceSpec", "name": "BATPhysicalDeviceSpec", "version": "1", "entityType": "PhysicalDevice", "startDate": "2020-09-30T00:00:01.000Z", "endDate": "2038-01-19T08:44:07.000Z" }, "place": [ { "id": "1", "href": "http://hostname:port/InventoryRSOpenAPI/place/1", "name": "BATLocation", "@referredType": "GeographicLocation" } ], "physicalConnectors": "http://hostname:port/InventoryRSOpenAPI/resourceInventoryManagement/version/physicalDevice/4-1/physicalConnectors", "physicalPorts": "http://hostname:port/InventoryRSOpenAPI/resourceInventoryManagement/version/physicalDevice/4-1/physicalPorts" }
Merge Patch for Roles
Example of Request Body
The following example shows the request body for updating the roles of a Physical Device in Merge Patch format.
{ "@type": "PhysicalDevice", "name": "BAT_PD", "roles": [ { "roleName": "BATRoleSpec", "roleType": "TOPOLOGY" } ] }
Example of Response Body
The following example shows the contents of the response body in Merge Patch format.
{ "id": "4-1", "href": "http://hostname:port/InventoryRSOpenAPI/resourceInventoryManagement/version/resource/4-1", "@type": "PhysicalDevice", "@baseType": "PhysicalResource", "name": "BAT_PD", "version": "1", "lifecycleState": "INSTALLED", "lifecycleSubState": "UNASSIGNED", "startDate": "2020-10-01T19:53:55.141Z", "endDate": "2038-01-19T08:44:07.000Z", "resourceCharacteristic": [ { "name": "BATMODEL", "valueType": "ALPHANUMERIC", "value": "Model223DA" } ], "resourceSpecification": { "id": "BATPhysicalDeviceSpec", "href": "http://hostname:port/InventoryRSOpenAPI/specification/BATPhysicalDeviceSpec", "name": "BATPhysicalDeviceSpec", "version": "1", "entityType": "PhysicalDevice", "startDate": "2020-09-30T00:00:01.000Z", "endDate": "2038-01-19T08:44:07.000Z" }, "place": [ { "id": "2", "href": "http://hostname:port/InventoryRSOpenAPI/place/2", "name": "BATAddress", "@referredType": "GeographicLocation" } ], "physicalConnectors": "http://hostname:port/InventoryRSOpenAPI/resourceInventoryManagement/version/physicalDevice/4-1/physicalConnectors", "physicalPorts": "http://hostname:port/InventoryRSOpenAPI/resourceInventoryManagement/version/physicalDevice/4-1/physicalPorts", "roles": [ { "roleName": "BATRoleSpec", "roleType": "TOPOLOGY" } ] }
JSON Patch for Resource Characteristics
Example of Request Body
The following example shows the request body for updating the resource characteristics of a Physical Device in JSON Patch format.
[ { "op": "replace", "path": "/resourceCharacteristic/value?resourceCharacteristic.name=BATMODEL", "value": "MODEL111PD" } ]
Example of Response Body
The following example shows the contents of the response body in JSON Patch format.
{ "id": "4-1", "href": "http://hostname:port/InventoryRSOpenAPI/resourceInventoryManagement/version/resource/4-1", "@type": "PhysicalDevice", "@baseType": "PhysicalResource", "name": "BAT_PD_Updated", "version": "1", "lifecycleState": "INSTALLED", "lifecycleSubState": "UNASSIGNED", "startDate": "2020-10-01T19:53:55.141Z", "endDate": "2038-01-19T08:44:07.000Z", "resourceCharacteristic": [ { "name": "BATMODEL", "valueType": "ALPHANUMERIC", "value": "MODEL111PD" } ], "resourceSpecification": { "id": "BATPhysicalDeviceSpec", "href": "http://hostname:port/InventoryRSOpenAPI/specification/BATPhysicalDeviceSpec", "name": "BATPhysicalDeviceSpec", "version": "1", "entityType": "PhysicalDevice", "startDate": "2020-09-30T00:00:01.000Z", "endDate": "2038-01-19T08:44:07.000Z" }, "physicalConnectors": " http://hostname:port/InventoryRSOpenAPI/resourceInventoryManagement/version/physicalDevice/4-1/physicalConnectors", "physicalPorts": " http://hostname:port/InventoryRSOpenAPI/resourceInventoryManagement/version/physicalDevice/4-1/physicalPorts" }
JSON Patch for Resource Relationships
Example of Request Body
The following example shows the request body for updating the resource relationships of a Physical Device in JSON Patch format.
[ { "op": "replace", "path": "/resourceRelationship/resourceRef?resourceRelationship.type=MAPPEDTO&resourceRelationship.resourceRef.id=1-75002", "value": { "id": "1-75001", "@type": "LogicalDevice" } } ]
Example of Response Body
The following example shows the contents of the response body in JSON Patch format.
{ "id": "4-1", "href": "http://hostname:port/InventoryRSOpenAPI/resourceInventoryManagement/version/resource/4-1", "@type": "PhysicalDevice", "@baseType": "PhysicalResource", "name": "BAT_PD_Updated", "version": "1", "lifecycleState": "INSTALLED", "lifecycleSubState": "UNASSIGNED", "startDate": "2020-10-01T19:53:55.141Z", "endDate": "2038-01-19T08:44:07.000Z", "resourceRelationship": [ { "type": "MAPPEDTO", "resourceRef": { "id": "1-75001", "href": "http://hostname:port/InventoryRSOpenAPI/resourceInventoryManagement/version/resource/1-75001", "@type": "LogicalDevice" } } ], "resourceCharacteristic": [ { "name": "BATMODEL", "valueType": "ALPHANUMERIC", "value": "Model223DA" } ], "resourceSpecification": { "id": "BATPhysicalDeviceSpec", "href": "http://hostname:port/InventoryRSOpenAPI/specification/BATPhysicalDeviceSpec", "name": "BATPhysicalDeviceSpec", "version": "1", "entityType": "PhysicalDevice", "startDate": "2020-09-30T00:00:01.000Z", "endDate": "2038-01-19T08:44:07.000Z" }, "physicalConnectors": "http://hostname:port/InventoryRSOpenAPI/resourceInventoryManagement/v2/physicalDevice/4-1/physicalConnectors", "physicalPorts": "http://hostname:port/InventoryRSOpenAPI/resourceInventoryManagement/v2/physicalDevice/4-1/physicalPorts" }
JSON Patch for Related Party
Example of Request Body
The following example shows the request body for updating the related parties of a Physical Device in JSON Patch format.
[ { "op": "replace", "path": "/relatedParty?relatedParty.id=1", "value": { "id": "75001" } } ]
Example of Response Body
The following example shows the contents of the response body in JSON Patch format.
{ "id": "12-1", "href": "http://localhost:7026/InventoryRSOpenAPI/resourceInventoryManagement/v2/resource/12-1", "@type": "CustomObject", "@baseType": "LogicalResource", "name": "BAT_CO", "version": "1", "lifecycleState": "INSTALLED", "lifecycleSubState": "UNASSIGNED", "startDate": "2020-09-29T19:38:38.187Z", "endDate": "2038-01-19T08:44:07.000Z", "resourceSpecification": { "id": "BATCOSpec", "href": "http://localhost:7026/InventoryRSOpenAPI/specification/BATCOSpec", "name": "BATCOSpec", "version": "1", "entityType": "CustomObject", "startDate": "2020-09-30T00:00:01.000Z", "endDate": "2038-01-19T08:44:07.000Z" }, "relatedParty": [ { "id": "75001", "href": "http://localhost:7026/InventoryRSOpenAPI/party/75001", "name": "Owner_Party", "@referredType": "Party" } ] }
JSON Patch for Place
Example of Request Body
The following example shows the request body for updating the place of a Physical Device in JSON Patch format.
[ { "op": "replace", "path": "/place?place.id=1", "value": { "id": "2", "@referredType": "GeographicLocation" } } ]
Example of Response Body
The following example shows the contents of the response body in JSON Patch format.
{ "id": "4-1", "href": "http://localhost:7026/InventoryRSOpenAPI/resourceInventoryManagement/v2/resource/4-1", "@type": "PhysicalDevice", "@baseType": "PhysicalResource", "name": "BAT_PD", "version": "1", "lifecycleState": "INSTALLED", "lifecycleSubState": "UNASSIGNED", "startDate": "2020-10-08T20:12:24.056Z", "endDate": "2038-01-19T08:44:07.000Z", "resourceCharacteristic": [ { "name": "BATMODEL", "valueType": "ALPHANUMERIC", "value": "MODEL123" } ], "resourceSpecification": { "id": "BATPhysicalDeviceSpec", "href": "http://localhost:7026/InventoryRSOpenAPI/specification/BATPhysicalDeviceSpec", "name": "BATPhysicalDeviceSpec", "version": "1", "entityType": "PhysicalDevice", "startDate": "2020-09-30T00:00:01.000Z", "endDate": "2038-01-19T08:44:07.000Z" }, "place": [ { "id": "2", "href": "http://localhost:7026/InventoryRSOpenAPI/place/2", "name": "BATAddress", "@referredType": "GeographicLocation" } ], "physicalConnectors": "http://localhost:7026/InventoryRSOpenAPI/resourceInventoryManagement/v2/physicalDevice/4-1/physicalConnectors", "physicalPorts": "http://localhost:7026/InventoryRSOpenAPI/resourceInventoryManagement/v2/physicalDevice/4-1/physicalPorts" }
JSON Patch for Roles
Example of Request Body
The following example shows the request body for updating the roles of a Physical Device in JSON Patch format.
[ { "op": "replace", "path": "/roles?role.name=InvUserRole", "value": { "roleName":"BATRoleSpec" } } ]
Example of Response Body
The following example shows the contents of the response body in JSON Patch format.
{ "id": "4-1", "href": "http://localhost:7026/InventoryRSOpenAPI/resourceInventoryManagement/v2/resource/4-1", "@type": "PhysicalDevice", "@baseType": "PhysicalResource", "name": "BAT_PD", "version": "1", "lifecycleState": "INSTALLED", "lifecycleSubState": "UNASSIGNED", "startDate": "2020-10-09T16:22:01.950Z", "endDate": "2038-01-19T08:44:07.000Z", "resourceCharacteristic": [ { "name": "BATMODEL", "valueType": "ALPHANUMERIC", "value": "MODEL123" } ], "resourceSpecification": { "id": "BATPhysicalDeviceSpec", "href": "http://localhost:7026/InventoryRSOpenAPI/specification/BATPhysicalDeviceSpec", "name": "BATPhysicalDeviceSpec", "version": "1", "entityType": "PhysicalDevice", "startDate": "2020-09-30T00:00:01.000Z", "endDate": "2038-01-19T08:44:07.000Z" }, "physicalConnectors": "http://localhost:7026/InventoryRSOpenAPI/resourceInventoryManagement/v2/physicalDevice/4-1/physicalConnectors", "physicalPorts": "http://localhost:7026/InventoryRSOpenAPI/resourceInventoryManagement/v2/physicalDevice/4-1/physicalPorts", "roles": [ { "roleName": "BATRoleSpec", "roleType": "TOPOLOGY" } ] }