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

Bad Request error when adding a link

I'm trying to add a link to an existing work item using REST/OAuth. I get the work item, find its rtc_cm:com.ibm.team.workitem.linktype.relatedartifact.relatedArtifact element and get the oslc_cm:collref attribute. From here, I've tried 2 different approaches. First, I tried following the instructions here: https://jazz.net/wiki/bin/view/Main/ResourceOrientedWorkItemAPIv2#Adding_Links_to_a_Work_Item. That says to POST a new link entry to the collection URL. Second, I tried getting the collection, adding a new element and doing a PUT on the collection URL. Both of these ended up with a Bad Request error.

Is there any way to figure out what's wrong with my request? I have no idea where to go from here.

Thanks,
Eric

0 votes



2 answers

Permanent link
More specific info:

1) I set up OAuth and have a valid token.
2) I have a URL for a work item: https://localhost:9443/jazz/resource/itemName/com.ibm.team.workitem.WorkItem/1
3) I GET that work item
4) I find the rtc_cm:com.ibm.team.workitem.linktype.relatedartifact.relatedArtifact element
5) I get the oslc_cm:collref attribute
6) I POST to the collref URL using the following:
Content-Type: application/x-oslc-cm-change-request+xml
Accept: application/xml
content: <rtc_cm:Reference rdf:resource="someURL" oslc_cm:label="foo" />

I have also tried getting the collection, modifying it and doing a PUT with the whole collection.

0 votes


Permanent link
I understand the topic is quite old, but for someone who comes across this link searching for a solution, a link can be added using oslc directly using a request of the following type.

Request URL : https://yourserveraddress/ccm/resource/itemName/com.ibm.team.workitem.WorkItem/<workItemId>
Request Method : PUT

Headers :
"Content-Type","application/x-oslc-cm-change-request+json"
"Accept","application/json"

Request Body:
{
"rtc_cm:com.ibm.team.workitem.linktype.relatedartifact.relatedArtifact":
{
"rdf:resource":"<Link>",
"oslc_cm:label":"<Label_Value>"
}
}

Cheers,
Arun

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
× 10,938

Question asked: Aug 03 '09, 9:07 a.m.

Question was seen: 7,124 times

Last updated: Aug 03 '09, 9:07 a.m.

Confirmation Cancel Confirm