HistoryViewLinks to this page 2012 September 7 | 12:52 pm

Scenario: Update Link Properties

In this scenario the client wishes to change a property on an existing link from an AM resource to a Change Management work item. The overall process is to GET the AM resource, modify the resouce contents and PUT back the updated resource. The use of ETags is used to manage concurrent modification.

This scenario assumes that the service provider allows the modification of resource properties and that the user has the permissions to do so. The client has a URI reference to an AM resource ( https://am.acme.com/resources/res323), and knows the URI of the externally managed work item resource ( https://cm.acme.com/wi/wi113) and the specific link type ( http://acme.com/links/trackedBy).

1. The client GET’s the AM resource to insert a link into, and notes the ETag value.

Request

GET https://am.acme.com/resources/res323
Accept: application/x-oslc-am-resource+xml

Response

200 OK
Content-Type: application/x-oslc-am-resource+xml
ETag: "_siemvnshyu2746sakalfuy"

<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:dc="http://purl.org/dc/terms/" 
   xmlns:oslc_am="http://open-services.net/xmlns/am/1.0/"
   rdf:about="https://acme.com/resources/res323">

    <oslc_am:Resource>
      <dc:title>ServiceInterface</dc:title>
      <dc:description>This interface is used to do service things.</dc:description>
      <dc:type rdf:resource="http://www.eclipse.org/uml2/3.0.0/UML/Interface" />
      <dc:format>application/x-uml+xml</dc:format>
    </oslc_am:resource>

    <acme:trackedBy rdf:resource="https://cm.acme.com/wi/wi113"/>

   </oslc_am:resource> 

</rdf:RDF>

2. The client modifies the content, inserting a new <rdf:Description> link element into the body of the <rdf:RDF> element. If the <acme:trackedBy> element does not include an rdf:ID attribute (that is referenced by the <rdf:Description> element) the client must add it.

The client then PUTs back the resource to the same URI with the current ETag value in the If-Match header. If the service provider permits the the insertion of properties on link, the user has authorization, the syntax of the link is correct, the service provider will response with a 200 OK response.

Request

PUT https://am.acme.com/resources/res323
Content-Type: application/x-oslc-am-resource+xml
If-Match: "_siemvnshyu2746sakalfuy"

<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:dc="http://purl.org/dc/terms/" 
   xmlns:oslc_am="http://open-services.net/xmlns/am/1.0/"
   xmlns:acme="http://acme.com/links/"
   xml:base="https://acme.com/resources/res323"   
   rdf:about="https://acme.com/resources/res323">

    <oslc_am:Resource>
      <dc:title>ServiceInterface</dc:title>
      <dc:description>This interface is used to do service things.</dc:description>
      <dc:type rdf:resource="http://www.eclipse.org/uml2/3.0.0/UML/Interface" />
      <dc:format>application/x-uml+xml</dc:format>
      <acme:trackedBy rdf:ID="id1" rdf:resource="https://cm.acme.com/wi/wi113"/>
    </oslc_am:resource>

    <rdf:Description rdf:about="#id1">
        <dc:description>This link is an example only.</dc:description>
    </rdf:Description> 

</rdf:RDF> 

Response

200 OK
ETag: "_sownmds21sa92js6aloaa"