Creating OSLC resources
You use the HTTP POST method to create an instance of an OSLC resource. You can then share the resource with other applications, and update the resource by using the PUT, PATCH, or MERGE methods.
About this task
The OSLC client
sends a JSON document that conforms to the shape of the resource as
published in the shape document. The data is sent to OSLC in
the HTTP request body in JSON format and the HTTP header Content-Type
is set as the MIME type application/json
. If the
request is processed successfully, the OSLC client
receives a location HTTP header with the URI of the newly created
resource. If you want to see the properties of the newly created resource,
you can include a properties header in the request and indicate which
properties you want to see. A header property that is named Properties is
returned with the specified properties.
Accept: application/rdf-xml
transactionid: 6001
Content-Type: application/json;charset=utf-8
If the request is processed successfully, the OSLC client receives the following response:
201 Created
Location: http://yourserver/oslc/so/WorkTask/10269
ETag: 1376596202470
If an action is passed in, the action must be a valid action for the current state of the record. For example, if the current state of the record is Draft, Save is often a valid action. The action is called after the record is created.
In the query result page (oslc/spq), if oslc.select includes a wildcard (*), or in the query details page (oslc/os), if no oslc.properties parameter is provided, the result includes all actions that can be performed for each record that is retrieved. The form of the action is, "tririga:action":["action1","action2",…].
OSLC requests
can fail for various reasons, such as business validation, authentication,
or authorization. For example, the OSLC client
might receive a 400 Bad Request
error followed by
the HTTP body that contains the details of the error.