【问题标题】:How create Issues with API/CURL to Bitbucket如何使用 API/CURL 向 Bitbucket 创建问题
【发布时间】:2020-08-25 23:59:28
【问题描述】:

我正在尝试使用 Windows CURL 命令在 Bitbucket 中创建问题,但它不起作用,我收到以下错误消息:

{"type": "error", "error": {"message": "No import job started"}}

我的命令 CURL:

curl -u username:password -X GET https://api.bitbucket.org/2.0/repositories/name/name2/issues/import -H "Content-Type: application/json" --data @data.jsonson

我正在尝试以 JSON 格式发送以下结果:

{
"title": "title"
 }

但它不起作用。

有人知道我可以如何创建问题吗?

【问题讨论】:

    标签: json api curl bitbucket issue-tracking


    【解决方案1】:

    我想,您应该使用不同的 URL 路径来发布问题,请参阅here 了解发布方法。应该是这样的:https://api.bitbucket.org/2.0/repositories/username/reponame/issues 对于仅发布标题的问题,您可以使用:

    curl --ssl-no-revoke -u username@password -X POST -H "Content-Type: application/json" -d "{\"title\" : \"test2\"}" https://api.bitbucket.org/2.0/repositories/username/reponame/issues
    

    要发布问题的内容,请使用内容标签:

    curl --ssl-no-revoke -u username@password -X POST -H "Content-Type: application/json" -d "{\"title\" : \"test2\",\"content\": {\"raw\": \"just test text\", \"markup\": \"plaintext\"}}"  https://api.bitbucket.org/2.0/repositories/username/reponame/issues
    

    例如对我来说这很有效(这是我的私人仓库):

    curl --ssl-no-revoke -u myaccountname@mypasswordname -X POST -H "Content-Type: application/json" -d "{\"title\" : \"test2\",\"content\": {\"raw\": \"just test texts\", \"markup\": \"plaintext\"}}" https://api.bitbucket.org/2.0/repositories/dvmochalov/testrepo/issues 
    

    --ssl-no-revoke - 仅适用于 windows curl,以防万一您正在运行带有防病毒软件的 Windows 或正在工作 with proxy

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-08-01
      • 2017-09-23
      • 2017-10-09
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多