简体   繁体   中英

How create Issues with API/CURL to Bitbucket

I'm trying to create issues in Bitbucket with the Windows CURL command, but it doesn't work, I'm getting this error message:

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

My command 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

I'm trying to send the following result in JSON:

{
"title": "title"
 }

But it doesn't work.

Does anyone know how I can create issues?

I suppose, you should use a different URL path for posting issues, please see here for post method. It should be like this: https://api.bitbucket.org/2.0/repositories/username/reponame/issues For posting just an issue with a title you could use this:

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

To post a content of the issue use content tag:

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

For example for me this worked (it's my private repo):

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 - works only for windows curl and it's just in case if you are running Windows with antivirus software or working with proxy .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM