gpt4 book ai didi

curl - JIRA REST API - 基本身份验证

转载 作者:行者123 更新时间:2023-12-02 21:07:04 33 4
gpt4 key购买 nike

我正在尝试使用 curl 从我公司的服务器检索 jira 问题,但到目前为止没有任何运气。

我已经测试了此处描述的两个示例 JIRA REST API Example - Basic Authentication没有成功。我按照“提供基本 Auth header ”示例中的描述对我的用户名和密码进行了 base64 编码,并输入了我想要获取的问题的 url。我在浏览器中测试了 url 我得到了 json 文档,所以 url 是正确的。

这是我的命令的样子

someuser@somehost:~$ curl -D- -X GET -H "Authorization: Basic base64encodedstringhere -H "Content-Type: application/json" https://jira.acme.com/rest/api/2/issue/KEY-666

然后我得到提示“>”但没有 json 文档。有什么我遗漏或做错了什么吗?

谢谢。

最佳答案

不要对用户名和密码进行编码 - curl 已经处理了!

curl -u "username:password" -X GET -H "Content-Type: application/json" https://jira.acme.com/rest/api/2/issue/KEY-666

如果您需要指定基本身份验证,请这样做:

curl -D- -X GET -H "Authorization: Basic usernamesndpasswordbase64 -H "Content-Type: application/json" https://jira.acme.com/rest/api/2/issue/KEY-666

其中用户名和密码字符串是一起编码的用户名:密码,例如通过

echo username:password | base64 | sed /Cg==/s///

这两个都对我在 Cygwin 下的 curl 有用。

关于curl - JIRA REST API - 基本身份验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35504743/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com