如何使用TestRail API进行身份验证?
我想使用TestRail API,但是我有身份验证问题。我设置了一个使用API播放的邮递员,并像以下查询:
https://my.testrail.io/index.php?/api/v2/get_users
授权标题具有基本身份验证的问题
Authorization: Basic [email protected]:apikey
我看到了另一个
{
"error": "Authentication failed: invalid or missing user/password or session cookie."
}
使用还尝试用我的密码替换API键,但这也不起作用。 Postman生成的curl命令是:
curl --location --request GET 'https://my.testrail.io/index.php?/api/v2/get_users' \
--header 'Authorization: Basic <EMAIL>:<APIKEY>' \
--header 'Cookie: tr_session=<GUID>'
我可以转到https://my.testrail.io/index.php?/api/v2/get_users
在我的浏览器中登录到testrail后工作。
I'd like to use the TestRail API, but I am having authentication issues. I setup a Postman to play with the API and query it like:
https://my.testrail.io/index.php?/api/v2/get_users
I saw another SO question that used the Authorization
header with basic authentication so I added that:
Authorization: Basic [email protected]:apikey
When I tried running this I got:
{
"error": "Authentication failed: invalid or missing user/password or session cookie."
}
I've also tried replacing the API key with my password, but that didn't work either. The cURL command generated by Postman is:
curl --location --request GET 'https://my.testrail.io/index.php?/api/v2/get_users' \
--header 'Authorization: Basic <EMAIL>:<APIKEY>' \
--header 'Cookie: tr_session=<GUID>'
I can go to https://my.testrail.io/index.php?/api/v2/get_users
in my browser after logging in to TestRail and that does work.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
以防万一仍然有人遇到这个问题(例如我)。
我发现您必须在添加API键
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
您需要在Postman中通过“授权”选项卡添加电子邮件/密钥,或者您需要自己编码并将其添加到“授权”标题中(Postman可以在使用“授权”选项卡时为您执行此操作)
You need to either add your email/key via "Authorization" tab in Postman or you need to encode them by yourself and put into "Authorization" header (Postman can do it for you when you use "Authorization" tab)