It's all about the answers!

Ask a question

Documentation Rational Team Concert about REST inferface


0
1
Sergey Tupchienko (11131) | asked Sep 20 '10, 9:44 a.m.
Hello all,

Please help me with my question.
I try to create reports from Rational Team Concert with using Rational Publishing Engine.
To do this I need to know URL for REST interface in RTC. Unfortunately I can't find the information in help for RTC.
Do you know where can I find URLs for REST interface in RTC?
Thanks in advance.

6 answers



permanent link
Ian Giblett (2621216) | answered Jan 24 '11, 9:48 a.m.
I also need to know how to do this,

Cheers,

Ian

permanent link
Jules Van de Velde (3633) | answered Apr 18 '11, 4:07 p.m.
The main document is located at https://:/jazz/rootservices

From there, you can navigate down into other REST services, such as project areas, etc

- Jules

Hello all,

Please help me with my question.
I try to create reports from Rational Team Concert with using Rational Publishing Engine.
To do this I need to know URL for REST interface in RTC. Unfortunately I can't find the information in help for RTC.
Do you know where can I find URLs for REST interface in RTC?
Thanks in advance.

permanent link
Carlos Ferreira (91123) | answered Dec 28 '11, 8:03 p.m.
JAZZ DEVELOPER
HI, I hit the same problem. This isn't yet documented in RTC v3.0.1.1 Help. At least I couldn't find it.

For REST API information I suggest:
1. This Jazz.net Wiki page:
https://jazz.net/wiki/bin/view/Main/ReportsRESTAPI#workitem

2. This Blog posting
http://teamgreenridge.wordpress.com/2011/05/04/reporting-on-rational-team-concert-timesheet-information-part-i/

My challenge is that this documentation doesn't provide information regarding how to authenticate with these REST Services. For example my understanding is that RTC using FORM authentication instead of Basic Authentication. However I was unable to get either of these to work in python using URLLib2

permanent link
sam detweiler (12.5k6189201) | answered Dec 29 '11, 7:51 a.m.
I don't know how to do it with Python, but I am able to authenticate to the rest URI with Salesforce.com

here is my salesforce.com class code specific to logon and to get the list of projects.

       Http http = new Http();

HttpRequest req = new HttpRequest();

// get the root document link to the catalog

req.setEndpoint(settings[0].ServerAddress__c+settings[0].BaseDocument__c);
req.setMethod('GET');
res = http.send(req);
if(res.getStatusCode()==200)
{
// get the providers element
Dom.XMLNode providers = res.getBodyDocument().getRootElement().getChildElement('cmServiceProviders', 'http://open-services.net/xmlns/cm/1.0/');
// and the catalog URL
String attr=providers.getAttributeValue('resource','http://www.w3.org/1999/02/22-rdf-syntax-ns#');
req.setEndpoint(attr);
req.setMethod('GET');
// set the userid/pw to operate under.
Blob headerValue = Blob.valueOf(settings[0].UserName__c + ':' + settings[0].UserPW__c);
String authorizationHeader = 'BASIC ' + EncodingUtil.base64Encode(headerValue);
req.setHeader('Authorization', authorizationHeader);
// send the request
res = http.send(req);

// should come back with an authorization request redirect (302)
if(res.getStatusCode()==302)
{
// get the sessionid string from the returned cookies
String[] cookies = res.getHeader('Set-Cookie').split(';');
String sessionid='';
for(Integer i=0;i<cookies.size();i++)
{
if (cookies[i].startswith('JSESSIONID'))
{
sessionid=cookies[i];
break;
}
}

// set the redirect endpoint
req.setEndpoint(res.getHeader('Location'));
// and the session id
req.setHeader('Cookie',sessionid);
req.setMethod('GET');
res = http.send(req);
//
if(res.getStatusCode()==200)
{
// we will have to deal with form logon later
String pw = settings[0].SecurityString__c;
pw=pw.replaceFirst('uname',settings[0].Username__c);
pw=pw.replaceFirst('upw',settings[0].Userpw__c);
req.setEndpoint(settings[0].ServerAddress__c + pw);
//req.setHeader('Referer',res.getHeader('Location'));
req.setMethod('GET');
req.setHeader('ContentType','application/x-www-form-urlencoded');
req.setHeader('Cookie',sessionid);
res = http.send(req);
}
// spin thru the remaining redirects..
while(res.getStatusCode()==302)
{
// redirect after login
req.setEndpoint(res.getHeader('Location'));
req.setHeader('Cookie',sessionid);
req.setMethod('GET');
res = http.send(req);
}
// we should have the project list document now
System.debug(res.getHeaderKeys());
System.debug(res.getBody());
// find the first project 'entry' node
Dom.XMLNode project = res.getBodyDocument().getRootElement().getChildElement('entry','http://open-services.net/xmlns/discovery/1.0/');
do
{
Dom.XMLnode provider = project.getChildElement('ServiceProvider','http://open-services.net/xmlns/discovery/1.0/');
String projectName =provider.getChildElement('title','http://purl.org/dc/terms/').getText();
String projectServicesURL = provider.getChildElement('services','http://open-services.net/xmlns/discovery/1.0/').getAttributeValue('resource','http://www.w3.org/1999/02/22-rdf-syntax-ns#');
req.setEndpoint(projectServicesURL);
req.setHeader('Cookie',sessionid);
req.setMethod('GET');
res = http.send(req);
// get the services list document
if(res.getStatusCode()==200)
{
DOM.XMLNode serviceslist = res.getBodydocument().getRootElement();
//System.debug(serviceslist);
Dom.XMLNode changeRequests = serviceslist.getChildElement('changeRequests','http://open-services.net/xmlns/cm/1.0/');
//System.debug(changeRequests);
Dom.XMLNode workitemFactory = changeRequests.getChildElement('factory','http://open-services.net/xmlns/cm/1.0/');
String workitemCreateUrl;
if(workitemFactory.getAttributeValue('default','http://open-services.net/xmlns/cm/1.0/')=='true')
{
workitemCreateUrl = workitemFactory.getChildElement('url','http://open-services.net/xmlns/cm/1.0/').getText();
system.debug(workitemCreateUrl);
}
String workitemQueryURL = (changeRequests.getChildElement('simpleQuery','http://open-services.net/xmlns/cm/1.0/')).getChildElement('url','http://open-services.net/xmlns/cm/1.0/').getText();
//system.debug(workitemQueryUrl);
//System.debug(workitemfactory);
ExportValue e=new ExportValue(projectName, workitemCreateUrl, workitemQueryURL);
result.add(e);
}
// find the projects parent node
Dom.XMLNode parent = project.getparent();
// remove the project node from the document
parent.removeChild(project);
// find the next project entry
project = parent.getChildElement('entry','http://open-services.net/xmlns/discovery/1.0/');
} while (project!=null);

}
}

permanent link
Carlos Ferreira (91123) | answered Jan 01 '12, 7:08 p.m.
JAZZ DEVELOPER
Hi Sam,
This helps. In that it shows a couple of things I am trying to get answers to for RTC REST API. For example what is the header name value pair for user id and pw when you base 64 encode it. Also does the RTC Rest interface Redirect after the first request. I suspect it probably does, so then what are the required cookies etc and headers we need to send back..

permanent link
William Owen (9145) | answered Mar 21 '12, 6:23 p.m.
JAZZ DEVELOPER
Hi Carlos,
Did you get this working? I have python examples that I can share if you are interested.

Your answer


Register or to post your answer.