Unable to update custom attribute in RTC via REST API

1.3k views Asked by At

I'm doing a POC and manually posting an XML block to our RTC server. I've set my content type header to the following:

application/x-oslc-cm-change-request+xml

In testing I started with trying to amend the title of a ticket i.e.

<dc:title>my test title</dc:title>.  

This works perfectly so I went on to update the custom attributes which is where I'm having my problems.

I'm pretty sure it's the formatting but I can't find any examples that have helped. In this instance I have a custom attribute of a 'medium' string type. In the XML I have tried:

<rtc_cm:com.my.domain.bookingLabel>my new value</rtc_cm:com.my.domain.bookingLabel>

I found a post which seemed to suggest that perhaps rtc_ext should be used in place of rtc_cm as the prefix. I tried this suggestion also but it had no impact. No errors are generated and all the work item information is returned back after the post action, but this specific custom attribute remains unchanged.

The doc I've been working from for the initial POC is from the Jazz website covering OSLC v2: https://jazz.net/library/article/352

Thanks in advance!

1

There are 1 answers

0
Sulphy On

In my original XML it was using the format/approach listed in an articlce intended for RTC v2 / OSCLC v1 (https://jazz.net/library/article/352) e.g.

<dcterms:title>my title here</dcterms:title>

However things have moved on and by using a new document/guide provided in this thread (https://jazz.net/library/article/1001) I reworked the XML. I first used the GET method to obtain the details of a workitem (as described in the article) which is provided in the RDF format which you effectively just edit then post back. I then cleared out all the content between the opening and closing tag and inserted just one custom attribute entry for my test

...
<rdf:Description rdf:about="https://myserver:9100/jazz/resource/ItemName/com.ibm.team.workitem.WorkItem/12345">
   <rtc_ext:com.my.custom.attribute.BookingRef>my value here</rtc_ext:com.my.custom.attribute.BookingRef>
</rdf:Description>
...

In testing I just used two headers in my call via the RESTClient addon for Firefox. Content-Type=application/rdf+xml and Accept: application/rdf+xml (using the PUT verb)

And voila, I can now change the values of my custom attributes.