Replacement of an OSLC resource
The HTTP PUT method replaces all of the properties of an OSLC resource, including literal properties and local resource properties. The PUT method also deletes any local resource properties that are not included in the request.
When you use the PUT method to replace an OSLC resource, the following rules apply:
- All literal properties that are specified in the HTTP request document are updated. Any literal property that is not specified as part of the request is not explicitly affected by the request. However, literal properties can be implicitly affected by the business logic that is associated with the resource.
- All local resource properties are replaced by their corresponding values in the request. When a resource property is included in a PUT request, the value replaces the value on the server. If a resource property is not included in a HTTP request, the corresponding property is deleted on the server.
- You cannot explicitly update reference resources but you can update properties that refer to the resource, and the properties follow the update model of literal properties.
In the following examples, a work order resource has one literal property, title, and one resource property wplabor. The wplabor property points to the local resource WPLABOR and is associated with two wplabor records. If a PUT request contains the title property and no wplabor property, the title is updated and the wplabor data is deleted.
Example: Updating a literal property
PUT /maximo/oslc/os/oslcwodetail/abc
{
"dcterms:title": "Check-out Leaking – Modified for Test"
}
204 No Content
ETag: 123456
The title is changed to Check-out
Leaking – Modified for Test
. Because the wplabor data
is not included, the wplabor records are deleted.
Example: Updating a resource property
PUT /maximo/oslc/os/oslcwodetail/abc
{
“spi:wplabor”: [
{
“spi_wm:wplaborid": "0000000067",
"spi_wm:rate": 18.5
}
]
}
204 No Content
ETag: 123456
The request initiates a search for
a wplabor record with the ID 0000000067
. If this
wplabor record exists, it is updated. If no matching record is found,
a new wplabor record is created with the ID 0000000067
.
All other wplabor data for this work order resource is deleted. Because
the title property is not included, the title
is not part of the request and the value is unaffected.