Question

Is it possible to modify a property of a change request by using the OSLC-CM REST API of a change management system. The system that I'm trying to achieve that is Rational Change. I can browse and query via the REST API, but to modify anything I need to resort to command line which is rather slow. Is there a way?

BR, Pawel

Was it helpful?

Solution 2

So I've finally got it working with some help from googlegroups

To recap what I've done so that someone else might benefit too (I really have searched for it and the IBM documentation is as in most of the cases not helping):

So to modify PR/CR' implement_actual_effort attribute on the Rational Change server the following procedure was successful (using Firefox REST plugin): 1. In Headers set: Accept to application/xml, Content-Type to application/xml

  1. Put the oslc address of the cr i URL in my case it was: http://[IP:PORT]/change/oslc/db/[DB hex ID]/role/User/cr/[web_encoded_name_of_the_CR]?oslc_cm.properties=change:implement_actual_effort (note in browser http://[IP:PORT]/change/oslc/db/[DB hex ID]/role/User/cr/[web_encoded_name_of_the_CR] will open change page of the CR/PR)
  2. In REST client set Method to GET and press SEND
  3. Click on the Response Body (RAW), copy xml Body
  4. Change Method to PUT, change the value of the attribute (in the xml in Body window)
  5. Press SEND
  6. Attribute should have been changed right now, and the response should be similiar to what you've sent, with the attribute showing the change.

Note that to change an attribute (called property from oslc point of view) one has to provide ?oslc_cm.properties=[properties delimited with comma] and in the request body xml the same properties have to be present, if I remember correctly if the property isn't mentioned in the xml it will be set to default

I hope this helps someone

BR,

Pawel

OTHER TIPS

To update resources using the OSLC-CM REST API you simply just can use HTTP PUT. In order to do this, you'll first need the URL of the Change Request.

The steps to achieve this (using any HTTP client) are:

  1. acquire URL for Change Request (usually done by query, or stored reference, etc)
  2. Perform an HTTP GET on that URL, specifying a format for use in editing. This is done using 'Accept' header, some typical values would be 'application/xml', 'application/json' or 'application/rdf+xml'.
    1. Note, it is a good idea to set the header 'OSLC-Core-Verson: 2.0' as well to ensure you are working with the 2.0 formats.
  3. Once you have fetched the resource, modify the property to the value you want.
  4. Using HTTP PUT, send the modified resource in the content body to the same URL you fetched the resource from.
    1. Additionally you will most likely need to pass along some additional headers to help the server detect any possible conflict.
  5. You should get back a 200 (OK) or 204 (No content) response on success.

An optimization would be to do the same steps as above but only request the properties of interest and only send them by using the selective properties feature of OSLC.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top