简体   繁体   English

如何使用 API/CURL 创建问题到 Bitbucket

[英]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:我正在尝试使用 Windows CURL 命令在 Bitbucket 中创建问题,但它不起作用,我收到此错误消息:

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

My command CURL:我的命令 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:我正在尝试在 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.我想,您应该使用不同的 URL 路径来发布问题,请参阅此处了解发布方法。 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:它应该是这样的: 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

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 . --ssl-no-revoke - 仅适用于 windows curl 并且以防万一您使用防病毒软件运行 Windows 或使用代理

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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