It's all about the answers!

Ask a question

Authentification to Rational Team Concert with Javascript and REST Api


Alexandre Pire (111) | asked Feb 02 '17, 4:51 a.m.

I'm building a Web application to access some informations about project-areas/team-areas | WorkItems | etc... I want to get thoses informations with Javascript and I used the REST Api / OSLC.

I'm facing some troubles with the authentification.
I don't know how can I create and manage the authentification to the server.
I have the username and password but what should I do with that ?

Is there a guide or tutorial to use the REST api with javascript ?

I tried to use curl in a php file but it didn't work (it returned me an empty string maybe because I was not logged at that time ?)...

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://<server>/ccm/rpt/repository");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HEADER, 0);
$response = curl_exec($ch);
curl_close($ch);
echo $response;


Thanks in advance for your help !

2 answers



permanent link
Donald Nong (14.4k313) | answered Feb 03 '17, 3:22 a.m.

Check out this post and see if it helps.
https://jazz.net/forum/questions/170030/rtc-oslc-authenticate-with-javascript

If the JavaScript is running as part of RTC (as a OpenSocial Widget for example), you can check out these posts.
https://jazz.net/forum/questions/215022/access-rtc-with-oslc-using-javascript
https://jazz.net/forum/questions/212195/how-to-create-work-item-using-javascript-within-an-opensocial-gadget

But reading your post, I have the impression that you get confused about what you are doing. If you use Perl, it runs on the server where your own web application runs, there should be no involvement of JavaScript at all. In this case, there are plenty of sample Perl scripts on jazz.net. If you indeed want to use JavaScript on the client side (a browser) of your own web application, it means that it reads data from RTC, then feeds back to the backend (server side) of your application - that's a lot of work to do. I don't know why you would make it so complicated.


permanent link
Jim Amsden (20836) | answered Feb 07 '17, 11:58 a.m.

There some sample code at https://github.com/OSLC/oslc-client that might be helpful. This uses JEE Form based authentication to connect a JavaScript client to RTC.


Your answer


Register or to post your answer.