In this scenario we create a new Author resource in a project that is managing resources from the Examples domain. An Author resource is a simple resource only requiring a name. The overall process to create a new resource is to:

  1. Generate a new URI for the resource (implictly creating a changeset)
  2. PUT the triples for the new resource to the URI
  3. Commit the changeset.

This scenario requires the models service end point, which is obtained from the root services document with the property http://jazz.net/xmlns/rmps/1.0/models. In this case it is: https://example.com:9435/dm/models.

This scenario also requires the configuration URI. The configuration URI represents which workspace to make the changes in.

Finally the scenario requires the use of the editing session end point. This end point is currently not published in the rootservices resource, and must be derived from the main server URL. The editing session URI is of the form https://host.port/dm/editingsession. In this scenario it is https://example.com:9435/dm/editingsessions.

In each of these calls the rmps.context query parameter must be set with the URL encoded configuration URI.

Generate new resource uri

POST a JSON object to the models service requestion the action to generate a URI. The DM internal header: X-ibm-rmps-internal: true must be present. The configuration URI is passed in with the rmps.context query parameter. As with all query parameter values, it must be URL encoded.

Request:

POST https://example.com:9435/dm/models?rmps.context=https%3A%2F%2Frsa-jade2k8.ottawa.ibm.com%3A9435%2Fdm%2Fstreams%2F16 HTTP/1.1

Query Parameters
rmps.context=https://example.com:9435/dm/streams/16
Headers
X-ibm-rmps-internal: true
{ "action" : "generateUri" }

Response:

HTTP/1.1 200 OK

Headers
Server: Apache-Coyote/1.1
Location: https://example.com:9435/dm/models/891
Content-Type: text/plain
Content-Length: 0
Date: Thu, 27 Sep 2012 13:40:22 GMT

If successful a 200 OK response is returned and the generated URI is returned in the Location header. In this example the new URI is https://example.com:9435/dm/models/891

PUT update to newly created resource URI

A new Author resource PUT to the generated URI. The representation MUST be Ntriples, and the DM Internal header MUST be present.

Request:

PUT https://example.com:9435/dm/models/891?rmps.context=https%3A%2F%2Frsa-jade2k8.ottawa.ibm.com%3A9435%2Fdm%2Fstreams%2F16 HTTP/1.1

Query Parameters
rmps.context=https://example.com:9435/dm/streams/16
Headers
X-ibm-rmps-internal: true
<https://example.com:9435/dm/models/891> <http://ibm.com/owl/library#authorName> "Bill Shakespear"^^<http://www.w3.org/2001/XMLSchema#string> . 
<https://example.com:9435/dm/models/891> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://jazz.net/ns/dm/core#Document> . 
<https://example.com:9435/dm/models/891> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://ibm.com/owl/library#Author> . 
<https://example.com:9435/dm/models/891> <http://purl.org/dc/terms/description> "The ol' bard."^^<http://www.w3.org/2001/XMLSchema#string> .

Response:

HTTP/1.1 200 OK

Headers
Server: Apache-Coyote/1.1
Content-Type: text/plain
Content-Length: 0
Date: Thu, 27 Sep 2012 13:40:23 GMT

Commit the changeset

POSTing the commit action, as a JSON object to the editing session URL with a rmps.context query parameter specifying the configuration will commit the changeset and make the changes visible to others in the workspace. The DM Internal header must be present.

Request:

POST https://example.com:9435/dm/editingsessions?rmps.context=https%3A%2F%2Frsa-jade2k8.ottawa.ibm.com%3A9435%2Fdm%2Fstreams%2F16 HTTP/1.1

Query Parameters
rmps.context=https://example.com:9435/dm/streams/16
Headers
X-ibm-rmps-internal: true
{ "action" : "commit" }

Response:

HTTP/1.1 200 OK

Headers
Server: Apache-Coyote/1.1
Content-Length: 0
Date: Thu, 27 Sep 2012 13:40:25 GMT

The resource can be removed in a similar manner, but sending a DELETE to the resource URI within a transaction