It's all about the answers!

Ask a question

command line API that supports registration of Inbound Consumers and Outbound Friends


Liora Milbaum (513289118) | asked Nov 29 '14, 12:27 p.m.
 I am in the process of automating a creation of a test/demo VM with CLM and JRS installed using vagrant.

One of the steps to install/setup JRS is to register the application as friend of the CLM applications. 
Is there a way to perform this prociedure via command line or using one of the APIs?

Thanks,
Liora



Comments
Liora Milbaum commented Dec 03 '14, 1:14 a.m. | edited Dec 03 '14, 7:15 a.m.

 Any Ideas?


Liora

Accepted answer


permanent link
Pavel Dubovitsky (2814) | answered Dec 03 '14, 10:00 p.m.
Hi,

I don't think there is documented API, but you can take a network trace in Firefox (or other Web browser) using development tools, copy correspondent requests as cURL, and implement command-line registration procedure.

Pavel
Liora Milbaum selected this answer as the correct answer

Comments
Liora Milbaum commented Dec 05 '14, 10:20 a.m.

 Good Idea. 

I have traced the correspondent requests as cURL but the outcome didn't work. I think there is some application logic done between each request. Any ideas how to figure this out?

Liora

3 other answers



permanent link
Pavel Dubovitsky (2814) | answered Dec 05 '14, 11:49 a.m.
Yes, there is a logic.
First, you need to execute login procedure (cookie jar needs to be used)
For consumers, is simple (if key did no exist): 
1) Send POST request to 
https://<server>:<port>/<app>/service/com.ibm.team.repository.service.internal.oauth.IOAuthRestService/registerNewConsumer
Parameters:
          consumerSecret => oauth secret,
          secretType     => 'STRING',
          name           => Key Name,
          consumerKey    => Key ID (optional, will be generated if not provided)
The response will contain consumerKey (which would be the same if it was provided in the original request)

2) If you need to make this key trusted, or associate user, you need to update key attributes. Send POST request to https://<server>:<port>/<app>/service/com.ibm.team.repository.service.internal.oauth.IOAuthRestService/setConsumerAttributes
Parameters:
          consumerKey    => "Key ID",
          trusted        => 'true', (or 'false')
          userId         => user id to associate

In case of configuring friends, it
1) checks that remote URL exists (root services document is available)
2) gets friends OAuth info
3) Requests provisional key from the remote site by providing name, trust settings and consumer secret
the response contains consumerKey id
4) registers new friend using the the key is and known secret
Then, it gives an option yo authorize the provisional key on remote server
after executing login procedure for the remote server, post 
https://<server>:<port>/<app>/service/com.ibm.team.repository.service.internal.oauth.IOAuthRestService/acceptProvisionalRegistration
Parameters:
          name           => Key Name,
          consumerKey    => Key ID 
          trusted => 'true', (or 'false')
          accept => 'true'

Pavel

Comments
Liora Milbaum commented Dec 05 '14, 11:58 a.m.

Pavel, 

I really appreciate your dedication to my challenge.
The issue is that I am not familiar with this technology yet. Would it be OK to ask for a code snippet which I can use to start with?

Thanks,
Liora


Liora Milbaum commented Dec 19 '14, 10:30 a.m.

 Anyone?


Ralph Schoon commented Dec 20 '14, 5:00 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Have you searched the forum for REST and OSLC? Have you looked at the library?  


Liora Milbaum commented Dec 20 '14, 5:30 a.m.

 I did. I have found how to login using REST API. Everything else wasn't related to the challenge I am facing.


Liora Milbaum commented Dec 20 '14, 1:57 p.m.

 Thanks. I have finally resolved it.


permanent link
Saqib Niaz (711223) | answered Apr 27 '16, 7:46 a.m.
 @pdubovitsky I have found your answer very helpful, i was also looking for a way to create an inbound consumer to jazz using restful api. i.e. https://<server>:<port>/<app>/service/com.ibm.team.repository.service.internal.oauth.IOAuthRestService/registerNewConsumer

I have a further question, this uri that is mentioned above, is it also published in some of the rootservices document of jazz app for example in https://<server>:<port>/<app>/rootservices
Instead of hard coding the above mentioned uri, I was looking for a way to access this uri from some published rdf document.
Thanks


permanent link
Pavel Dubovitsky (2814) | answered Apr 27 '16, 8:52 p.m.
@saqibniaz, it is not a documented API call. You can use it on your own risk.
Thanks

Your answer


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.