Usage Scenario: Resource Management CRUD Operations
The client is a REST client using HTTP methods to access resources managed by an OSLC AM service provider.
Create resource (via Creation Factory)
- A REST client obtains the oslc:CreationFactory resource from the oslc:ServiceProvider resource.
- If the service provider includes a shape then the client can determine exactly what properties are required in the resource creation request, otherwise the client is expected to know what is required in the RDF when creating a new instance of a resource.
- The authenticated client POSTs a new resource to the creation factory URL. The client is expected to provide the Content-Type header. The service provider is expected to accept content of this type. Standard HTTP content management protocols apply.
If the new resource is in NTriple or Turtle format then an empty URI reference (e.g.
<>) is used to represent the URI of the to-be-created resource URI. If RDF/XML is supported then the empty about attribute (e.g.
rdf:about="") represents the URI of the to-be-created resource.
- The service provider creates a new instance of the resource, and returns a
201 Created response with the URI of the new resource in the Location header. The ETag and Last-Modified headers are also expected to be returned.
Create resource (via Delegated UI Creator)
- An authenticated REST client obtains the oslc:creationDialog resource from the oslc:ServiceProvider resource.
- An authenticated desktop or web client GETs the creation dialog HTML resource and displays it to the user, using the delegated UI protocol defined in the Core specification.
- The user interacts with the creation dialog providing the necessary information to create the resource.
- The service provider responds with a JSON oslc:results object. This object contains the label and URI of each created resource (it is possible for more than one resource to be created).
- The desktop or web UI client accepts the response and notifies the user.
Retrieve resource instance
- An authenticated client performs a GET on an OSLC AM resource URI with the OSLC-Core-Version and Accept headers. The core version header should be 3.0(?), and the Accept header should be a type that the service provider provides (e.g. text/turtle, application/ntriples, application/rdf+xml, text/json, …).
- If the resource exists the service provider returns it in the requested format, along with the ETag header, Last-Modified, and OSLC-Core-Version headers.
- If the resource is large, the service provider may choose to page the response. The client is prepared to perform additional GETs on the rest of the pages to eventually receive the entire resource. As it is with RDF there is no expected ordering or priority of properties. The service provider includes
Update a resource
- The REST client GETs the full representation of a resource (see Retrieve resource, and notes the ETag header.
- The REST client PUTs back the resource with the updated properties, and the value of the ETag in an If-Match header.
- The service provider responds with a 200 OK, and an updated ETag value in a response header.
Delete a resource
- The REST client obtains the resource’s current ETag value, either by getting its full representation of a resource (see Retrieve resource, and the ETag header, or just gets the headers with a HEAD request.
- The REST client DELETEs the resource with the value of the ETag in an If-Match header.
- The service provider responds with a 200 OK.
- If the ETag does not match the current value, then the service provider returns with a 409 Conflict, or 412 Precondition Failed.