Authentication failed using Python

Thursday, November 30, 2023
Avatar

Hello,

I'm trying to get response form spiratest using python.

Here is the code I wrote.

import json, requests
body = {"highlightedLinkId": -8}
headers = {
    'accept': 'application/json',
    'Content-Type': 'application/json',
    'User-Agent': "John Smith",
}

params = {
    'username': 'SmithJ',
    'api-key': '{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXXX}',
}
url = "https://company.name.co.uk/SpiraTest/Services/Ajax/GlobalService.svc/GlobalNavigation_RetrieveWorkspaces"
response = requests.post(url, data=json.dumps(body), params=params, headers=headers)
print(response.text)

I've copied RSS / API Key from the settings.

 

However I have the following error:

'{"Message":"Authentication failed.","StackTrace":"","ExceptionType":""}'

 

Could you tell me please what I'm doing wrong, please.

Thank you in advance for any response. 

1 Replies
Thursday, November 30, 2023
Avatar
re: new_spiratest_user Thursday, November 30, 2023

That is not a valid API endpoint, that is in an internal service that requires an authenticated session.

Instead, please use one of these API endpoints:

https://api.inflectra.com/Spira/Services/

For example, for v7.0 REST API:

https://api.inflectra.com/Spira/Services/v7_0/RestService.svc

The documentation is here:

https://api.inflectra.com/Spira/Services/v7_0/RestService.aspx

Spira Helps You Deliver Quality Software, Faster and With Lower Risk

And if you have any questions, please email or call us at +1 (202) 558-6885

 

Statistics
  • Started: Thursday, November 30, 2023
  • Last Reply: Thursday, November 30, 2023
  • Replies: 1
  • Views: 842