It's all about the answers!

Ask a question

Creation and deletion of RTC work item tags witn API


Dmitry A. Lesin (21212950) | asked Oct 08 '14, 8:15 a.m.
Hi everybody!
Could somebody help me with API for creation and deletion the tags in Rational Team Concert? Is it possible?
I'm wondering for any information about API both at the server side in a typical follow-up action extension and with REST API.
Thank you very much in advance for any recommendations and references!

Accepted answer


permanent link
Ralph Schoon (55.8k23642) | answered Oct 08 '14, 8:53 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
For the Java API - regardless if client or server, it should work like this:
IWorkItem workItem = workingCopy.getWorkItem();
List tags = workItem.getTags2();
tags.add("NewTag");
workItem.setTags2(tags);

In the REST API I would expect you have to just add a new tag to the list and save the resource with all the data.

I have not tested the code, but it is analogue to several other cases. You would save the work item with the usual means e.g. using the operation pattern or work item save on client or server.
Dmitry A. Lesin selected this answer as the correct answer

Comments
Dmitry A. Lesin commented Nov 22 '14, 2:22 a.m.

As for REST API, I was able to successfully update a work item with tags. Next, I put the excerpts from log:

Started updating a workitem with ID=130
Sending HTTP request to server:
  Method: PUT
  URL: https://<SERVER_NAME>:9443/ccm/oslc/workitems/130?oslc_cm.properties=dc:title,dc:subject
  Headers: [Content-type=application/x-oslc-cm-change-request+xml, Accept=application/x-oslc-cm-change-request+xml]


Your answer


Register or to post your answer.