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.

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/ 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');

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


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.