【问题标题】:Postin gitlab issue发布 gitlab 问题
【发布时间】:2017-09-06 04:53:13
【问题描述】:

我有一个类似 gitlab 的 POST 请求

https://gitlab.com/api/v4/projects/4067343/issues?title=Issues%20with%20auth&labels=bug?private_token=MY_PRIVATE_TOKEN

但我唯一拥有的是:

{"message":"401 Unauthorized"}

任务是打开项目的问题。

错在哪里?

【问题讨论】:

  • 检查您尝试访问的用户标识或授权是否有效...
  • 根据官方文档,不需要id之类的。我更改 curl 命令 "curl --request POST --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" gitlab.example.com/api/v4/projects/4/…"

标签: api gitlab


【解决方案1】:

GitLab authentication 提到 private tokens 使用 as an header or query string

curl "https://gitlab.example.com/api/v4/projects?private_token=9koXpg98eAheJpvBs5tK"

但这并不意味着你必须使用第二个?,你应该用&分隔这些查询字符串

https://gitlab.com/api/v4/projects/4067343/issues?title=Issues%20with%20auth&labels=bug&private_token=MY_PRIVATE_TOKEN
                                                                                      ^^^

Query String structure

【讨论】:

猜你喜欢
  • 2022-01-18
  • 1970-01-01
  • 2022-01-09
  • 2020-03-11
  • 1970-01-01
  • 2010-10-11
  • 2018-11-29
  • 2013-01-10
  • 2017-07-06
相关资源
最近更新 更多