How to update RTC resources with OSLC?
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;