Creation of a resource instance

A consuming application uses the HTTP POST method to create an instance of an OSLC resource. Other applications can then share the resource.

The consuming application uses the HTTP POST method to send a JSON document that conforms to the published shape of the resource. The OSLC JSON format is associated with the application/json MIME type. When the request is processed successfully, the header of the HTTP response from the provider application includes the URI of the newly-created resource.

Example: Creating an instance of a resource

The following method creates the oslcwodetail resource:

POST /maximo/oslc/os/oslcwodetail
….
{
   "dcterms:creator": {
      "rdf:resource": "http://host:port/maximo/oslc/os/oslcperson/_V0lOU1RPTg--"
   },
   "dcterms:title": "Check-out Leaking",
   "spi_wm:orgid": "EAGLENA",
   "spi_wm:siteid": "BEDFORD",
   "spi_wm:woclass": "WORKORDER",
   "oslc:shortTitle": "T5050",
   "spi:asset": {
      "rdf:resource": "http://host:port/maximo/oslc/os/oslcasset/_MTMxNDUvQkVERk9SRA--"
   },
   "spi:location": {
      "rdf:resource": "http://host:port/maximo/oslc/os/oslcoperloc/_U0hJUFBJTkcvQkVERk9SRA--"
   },
   "spi:status": "WAPPR"
}…..

If the request is processed successfully, the consumer application receives the following response:

201 Created
Location: http://host:port/maximo/oslc/os/oslcwodetail/_ABCD--
ETag: 1234567

The message body of the HTTP response is empty. To get details of the newly-created resource, the consumer application must send an HTTP GET request to the URI that is specified in the HTTP header location property. The consuming application can use the ETag property in the HTTP header to send a conditional update request to the provider application.

OSLC requests can fail for various reasons, such as business validation, authentication, or authorization. If a request fails, the consuming application receives an HTTP error code as a response, such as a 400 Bad Request error and the message body contains the details of the error.