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
|
Accepted answer
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
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? 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. |
@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
|
|
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.
Comments
Any Ideas?