Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

How to add more links to a workitem to a linktype releatedartifacts by using OSLC.

 Hii,


I had a workitem of type Epic in this I am linking an item from another application(System Weaver). In SystemWeaver we had more number of items and I need to link more items to a single workitem by using the link type "releated artifact". I am able to link one item with one workitem, when I tried to link one more item to the same workitem then it is overridding the previous link.

Ex: Items: 1, 2
 WorkItem : Epic(Summery is Test- WI Id=45).
When I link item-1 with workitem id 45, it is created in links section for the link type "releatedArtifact". Now if again I try to link the item-2 with Workitem 45 then previous link is overridding and item-2 link is updating. I used put request here, below is my request body

HttpWebRequest put_request = (HttpWebRequest)WebRequest.CreateHttp(baseUrl + _putRTCUrl + workItemId);
put_request.Method = "PUT";
put_request.Headers.Add("Authorization", "Basic " + GetEncodedCredentials(UserName, Password));
put_request.Headers.Add("oslc_cm.properties", "dc:type");
put_request.Accept = "application/json";
put_request.ContentType = "application/json";

string requestBody = "{\"rtc_cm:com.ibm.team.workitem.linktype.relatedartifact.relatedArtifact\":[{\"oslc_cm:label\":\""+reqId + " "+lable+"\",\"rdf:resource\":\"swap://localhost:port/" + strHandler + "\"}]}";

Here I am using Put request can any one help me in this to update the new link without overridding the old link.


Thank you.


0 votes



One answer

Permanent link

 If you want to make progress on this, look how a work item looks like that has several links of the same type. Just do a GET to the URI of the work item, OSLC headers, logged in. Search for the work item type. 


You might then realize that it is a COLLECTION of links for each link type and if you want to have an additional link, you have to get the current values and then add another entry.

The OSLC PUT is just an Update and as of OSLC still requires the old data to be in the request. As far as I can tell, if you just write one link, it is interpreted as that are the links that are there. So if you only write one new the old one is considered deleted.
 

0 votes

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details

Question asked: Sep 29 '21, 7:25 a.m.

Question was seen: 611 times

Last updated: Sep 29 '21, 8:50 a.m.

Confirmation Cancel Confirm