It's all about the answers!

Ask a question

Plug IBM DOORS NG OSLC REST API into Power BI


minak pori (111) | asked Dec 07 '20, 12:24 p.m.
edited Dec 09 '20, 11:33 a.m.

 Hi all

Has anyone managed to achieve using the DOORS OSLC API in power bi? I am attempting to use a web data source with all the same URL and headers I would use with an API query however it gets stuck on the authentication page. Can't seem to find any assistance.

Thanks

https://tweakbox.mobi/","https://tweakbox.mobi/")" data-sheets-hyperlink="https://tweakbox.mobi/" data-sheets-userformat="{"2":268481,"3":[null,4,"\"$\"#,##0.00"],"9":1,"10":2,"14":[null,2,1136076],"15":"arial,sans,sans-serif","21":1}" data-sheets-value="{"1":2,"2":"https://tweakbox.mobi/"}" style="color: rgb(17, 85, 204); font-family: Arial; font-size: 10pt; text-align: center; text-decoration-line: underline; text-decoration-skip-ink: none;">https://tweakbox.mobi/

3 answers



permanent link
Davyd Norris (1.1k7) | answered Dec 07 '20, 5:51 p.m.
I have several clients who have tried this, and the PowerBI side is really problematic when you have to execute a login because it doesn't handle session cookies well.

To log into ELM you first need to hit a protected page and grab the session cookies, then check from the headers what method needs to be used to login. It will either be forms based login, or basic login. Then you need to supply authentication info and the session cookies from the first hit. After that you're logged in.

We found PowerBI had a lot of trouble doing the first hit and then saving cookies, but we eventually worked it out in the PowerBI UI.

The other option is to use OAuth and set up friendship between the servers.

Finally after all that we found that the authentication method was only available in the client and could not be set up on the PowerBI server to automatically be done on a schedule - I don't know if that's changed now.

permanent link
Ralph Schoon (58.5k23642) | answered Dec 07 '20, 12:43 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Comments
Ralph Schoon commented Dec 08 '20, 2:48 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

permanent link
Jim Amsden (22837) | answered Dec 07 '20, 1:39 p.m.

 Here's some Python code that you might use as a guide:


        self.base_url = server_url
        self.userid = user
        self.password = password
        self.spc = None
        self.sp = None
        self.ownerMap = dict()
        
        # Disable SSL so that we can read self-assigned certificates
        self.http = httplib2.Http(".cache", disable_ssl_certificate_validation=True)
        self.http.follow_redirects = True
        self.headers = {'Content-type': 'application/rdf+xml'}
        protectedResource = "/whoami"
       
        # Create an authentication challenge by attempting to access a protected resource
        resp, content = self.http.request( self.base_url + protectedResource, 'GET', headers=self.headers)
        if (resp.status == 404):
            # the JRS server does not support whoami
            protectedResource = ''
            resp, content = self.http.request( self.base_url + protectedResource, 'GET', headers=self.headers)

            
        if ('x-com-ibm-team-repository-web-auth-msg' in resp and resp['x-com-ibm-team-repository-web-auth-msg'] == 'authrequired'):
            # JEE Forms authentication
            resp, content = self.http.request( self.base_url + protectedResource, 'GET', headers=self.headers)
            self.headers['Cookie'] = resp['set-cookie'] 
            self.headers['Content-type'] = 'application/x-www-form-urlencoded'
          
            # now we can start the authentication via j_security_check page
            resp, content = self.http.request(self.base_url+'/j_security_check' , 'POST', headers=self.headers, 
                        body=urllib.parse.urlencode({'j_username': user, 'j_password': password}))
            # Successful login will set the LtpaToken2 required for subsequent authenticated access
            self.headers['Cookie'] = resp['set-cookie']
        else:
            # Try sending the credentials for OpenIDConnect
            self.http.add_credentials(user, password)
                         
        # check authentication was successful, if not throw exception
        resp, content = self.http.request( self.base_url + protectedResource, 'GET', headers=self.headers)
        assert (resp.status == 200), f"Login failed with status: {resp.status}"

Your answer


Register or to post your answer.