1

I’m trying to access the API of TestRail (by gurock) on our self-hosted TestRail server (version v5.1.0.3413). To use TestRail, we have to login with basic authentication plus form-based authentication. The sample call in the API documentation uses curl -u … to handle basic authentication. But this just gives me following error:

{“error”:“Authentication failed: invalid or missing user/password or session cookie.”}

I guess this is because I somehow have to provide the form-based login credentials. Has anybody here handled this scenario of TestRail API access with basic plus form-based authentication before?

Thanks in advance!

2 Answers 2

1

Just in case if someone still face this problem (e.g. me).

I've found that you have to press Save Settings after adding an API keys 🫠

  • Not saved: enter image description here

  • Saved: enter image description here

0

The following does the trick for me.

# Login
curl -u basicUser:basicPassword -c cookies -d "name=formUser&password=formPassword" -X POST "https://testrailserver/index.php?/auth/login"

# Get test statuses
curl  -u basicUser:basicPassword -b cookies -H "Content-Type: application/json" "https://testrailserver/index.php?/api/v2/get_statuses"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.