Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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

 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


0 votes

Comments

 Any Ideas?


Liora


Accepted answer

Permanent link
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

0 votes

Comments

 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
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

1 vote

Comments

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

 Anyone?

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

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

 Thanks. I have finally resolved it.


Permanent link
 @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

0 votes


Permanent link
@saqibniaz, it is not a documented API call. You can use it on your own risk.
Thanks

0 votes

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 2,358

Question asked: Nov 29 '14, 12:27 p.m.

Question was seen: 3,679 times

Last updated: Apr 27 '16, 8:52 p.m.

Confirmation Cancel Confirm