我正在使用curl 做一个非常基本的网络请求:
curl https://myinstance.atlassian.net/rest/api/2/project
-H "Authorization: Bearer <myPAT>"
但是我总是收到以下错误:
无法解析 Connect 会话身份验证令牌
令牌是在几秒钟前使用 JIRA 应用程序创建的,如下所述 https://confluence.atlassian.com/enterprise/using-personal-access-tokens-1026032365.html.
我还尝试使用 API 创建 PAT:
curl -X POST https://myinstance.atlassian.net/rest/pat/latest/tokens
-H "Content-Type: application/json"
-d '{"name": "tokenName","expirationDuration": 90}'
--user "myuser:mypassword"
结果是:
curl:(3) URL 被拒绝:端口号不是 0 到 65535 之间的十进制数字
卷曲:(3) URL 位置 3 中不匹配的右大括号/方括号:
90}'
尝试使用它作为“auth-token”的标头值而不是 Bearer token
curl --location 'https://myinstance.atlassian.net/rest/api/2/project' \
--header 'auth-token: <myPAT>'