It's all about the answers!

Ask a question

Using the REST API from curl, with RTC 4.0, how can I add a URL to a related Artifact?


Bill Rassieur (2123) | asked Jun 27 '13, 11:33 a.m.
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!

Accepted answer


permanent link
sam detweiler (12.5k6185201) | answered Jun 27 '13, 12:52 p.m.
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

Bill Rassieur selected this answer as the correct answer

Comments
sam detweiler commented Jun 27 '13, 12:57 p.m.

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.


Bill Rassieur commented Jun 27 '13, 1:53 p.m.

Sam, Nice to hear from you!
I've shown my appreciation of your response by accepting this as the needed answer.

One other answer



permanent link
Indradri Basu (1.8k1514) | answered Jun 27 '13, 12:27 p.m.
Hi Bill, you may want to take a look at the OSLC 2.0 Specification. The page also demonstrates with multiples examples.

Your answer


Register or to post your answer.