HowTo: Quality Center / REST API / VBScript – Non-Web Application Authentication
Question ID: 105769
0
0

How Do I authenticate using REST API / VBScript?

Marked as spam
Posted by (Questions: 122, Answers: 3)
Asked on January 2, 2015 5:06 pm
305 views
Answers (2)
0
Private answer

**Example:**

Sub Authenticate_AuthString()

Dim XMLHttpRequestObj, ALMServer, ALMUser, ALMPass, AuthString

Set XMLHttpRequestObj = CreateObject(''Msxml2.ServerXMLHTTP.6.0'')

ALMServer = ''http://localhost:8080/qcbin'' ''<--No trailing slash ALMUser = ''alex_alm'' ALMPass = '''' AuthString = '''' & ALMUser & '''' & ALMPass & ''''

XMLHttpRequestObj.open ''POST'', ALMServer & ''/authentication-point/alm-authenticate'', False
XMLHttpRequestObj.setRequestHeader ''Content-Type'',''application/xml''
XMLHttpRequestObj.setRequestHeader ''Accept'',''application/xml''
XMLHttpRequestObj.send(AuthString)

MsgBox ''-- Authenticate String --'' & vbCrLf & _
''Status Code : '' & XMLHttpRequestObj.status & vbCrLf & _
''Status Text : '' & XMLHttpRequestObj.statusText & vbCrLf & _
''-------------------'' & vbCrLf & vbCrLf & _
''Response Text : '' & vbCrLf & XMLHttpRequestObj.responseText, , ''Authenticate''

Set XMLHttpRequestObj = Nothing

End Sub

Marked as spam
Posted by (Questions: 3, Answers: 168)
Answered on January 2, 2015 5:20 pm
0
Private answer

I got this working like a charm on v11.52 however upgrading to v12.21 this code got broken.
I have been looking for a solution but no breakthrough yet, hence my trigger for help here...

Can somebody please help me getting the updated code for v12.21 or similar version ?

This is what I sorted out already :

- The URI has changed, I think one has to use ''/api/authentication/sign-in'' instead of ''''/authentication-point/alm-authenticate'' now ?

- I still get ''error 401 No credentials found the request'' -> I assume the way of passing the credentials changed ?

Thank you in advance !

Jan

Marked as spam
Posted by (Questions: 0, Answers: 1)
Answered on April 5, 2016 1:06 pm
EyeOnTesting

Welcome back to "EyeOnTesting" brought to you by Orasi Software, Inc.

X
Scroll to Top