It's all about the answers!

Ask a question

How to update RTC resources with OSLC?


Guilherme Silva (145) | asked Jun 06 '14, 11:59 a.m.
edited Jun 06 '14, 12:40 p.m.
Hi,

I'm trying to add/update comments and subscribers of work items in Rational Team Concert v4.x programmatically using Lyo OSLC with Perl but though able to update properties such as summary and description fields, the workitemUpdate subroutine doesn't seem to do the same with collections.
My guess is that it is due to the hardcoded base URI (resource/itemName/com.ibm.team.workitem.WorkItem) referring to work item properties so I tried PUTting the request directly to the comments collref URL of a given work item with below code.

use strict;
use warnings;
use XML::Simple;
use Lyo::OSLC::RTC::CM;

my $oslcclient = Lyo::OSLC::RTC::CM->new;

$oslcclient->credentials('user', 'password');
$oslcclient->setBaseURI('https://localhost:9443/ccm');
$oslcclient->debugging(1);

my $uri = 'https://localhost:9443/ccm/oslc/workitems/_NjDuMOpLEeOOrbZsRN6NKA/rtc_cm:comments';
my $new = '{"dc:description": "My new comment"}'; 

$oslcclient->GET($uri);

my $ETag = $oslcclient->responseHeader('Etag');

$oslcclient->PUT($uri, $new,
{
'If-Match' => $ETag,
'Accept' => 'text/json',
'Content-Type' => 'application/x-oslc-cm-change-request+json',
}
);

exit 1;

Be the first one to answer this question!


Register or 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.