Using the REST API from curl, with RTC 4.0, how can I add a URL to a related Artifact?
![](http://jazz.net/_images/myphoto/13fa63a9edfddfb75dcbbfc882c31662.jpg)
I would like to get a Perl script using curl to work and your advice would be appreciated, dear reader!
I think I have something wrong with my REST API URL that I'm passing to curl...
Using the article here:
http://www.ibm.com/developerworks/rational/library/10/integrate-perforce-with-rational-team-concert/index.html
I got the Perl script from that article and am trying to code my Perl as:
$cmd = "$curl -k -L -b $cookie -c $cookie -H \"Accept: application/json\" ".
"-H \"Content-Type: application/json\" ".
"-d \"{\\\"rdf:resource\\\":\\\"$cl_url\\\",".
"\\\"oslc_cm:label\\\":\\\"link for change list:${c_id}\\\"}\" ".
"https://${jazz}/jazz/oslc/workitems/${w_id}/".
"rtc_cm:com.ibm.team.workitem.linktype.relatedartifact.relatedArtifact";
WHERE:
- $cl_url is a string that gives the URL via p4web to the changelist
- $c_id is the changelist number
- $w_id is the work item id of the item in RTC to which I want to add the link
...etc...
when I try this against RTC 4.0.x - no link appears on the work item.
My theory is that the REST API has changed from the version the article was written against, vs. the 4.0.x server I'm playing on.
In any case, I just want it to work and your advice is appreciated!
I think I have something wrong with my REST API URL that I'm passing to curl...
Using the article here:
http://www.ibm.com/developerworks/rational/library/10/integrate-perforce-with-rational-team-concert/index.html
I got the Perl script from that article and am trying to code my Perl as:
$cmd = "$curl -k -L -b $cookie -c $cookie -H \"Accept: application/json\" ".
"-H \"Content-Type: application/json\" ".
"-d \"{\\\"rdf:resource\\\":\\\"$cl_url\\\",".
"\\\"oslc_cm:label\\\":\\\"link for change list:${c_id}\\\"}\" ".
"https://${jazz}/jazz/oslc/workitems/${w_id}/".
"rtc_cm:com.ibm.team.workitem.linktype.relatedartifact.relatedArtifact";
WHERE:
- $cl_url is a string that gives the URL via p4web to the changelist
- $c_id is the changelist number
- $w_id is the work item id of the item in RTC to which I want to add the link
...etc...
when I try this against RTC 4.0.x - no link appears on the work item.
My theory is that the REST API has changed from the version the article was written against, vs. the 4.0.x server I'm playing on.
In any case, I just want it to work and your advice is appreciated!
Accepted answer
![](http://jazz.net/_images/myphoto/13fa63a9edfddfb75dcbbfc882c31662.jpg)
change the OSLC URL from
https://${jazz}/jazz/oslc/ ...
to
https://${jazz}/ccm/oslc/...
the web server context name has changed from RTC 2 to RTC 3 and later
Sam
https://${jazz}/jazz/oslc/ ...
to
https://${jazz}/ccm/oslc/...
the web server context name has changed from RTC 2 to RTC 3 and later
Sam
Comments
![](http://jazz.net/_images/myphoto/d0f7b0b7bfc90721959d790b8a9bf79f.jpg)
note that the best thing to do to debug these kinds of scripting problems is the hand code the URL til you get it to work.
https://server/jazz will fail right away.
![](http://jazz.net/_images/myphoto/13fa63a9edfddfb75dcbbfc882c31662.jpg)
Sam, Nice to hear from you!
I've shown my appreciation of your response by accepting this as the needed answer.
One other answer
![](http://jazz.net/_images/myphoto/13fa63a9edfddfb75dcbbfc882c31662.jpg)
Hi Bill, you may want to take a look at the OSLC 2.0 Specification. The page also demonstrates with multiples examples.