如何使用TestRail API进行身份验证?

发布于 2025-02-11 18:08:59 字数 874 浏览 0 评论 0原文

我想使用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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

策马西风 2025-02-18 18:09:02

以防万一仍然有人遇到这个问题(例如我)。

我发现您必须在添加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 ????

如梦亦如幻 2025-02-18 18:09:02

您需要在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)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文