IBM TRIRIGA Application Platform Version 3.5.0

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.

When you send a create request, you can include the transaction ID in the HTTP request header. The transaction ID must be unique across all client applications. OSLC saves the transaction ID status in the database when the request is completed. If you submit a request with a transaction ID, OSLC checks whether the transaction exists in the database. If the transaction does exist, OSLC does not run the request. It returns an error that indicates that the request was not completed because the transaction ID exists. The following is an example header with the transaction ID specified:
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.



Feedback