使用Bitbucket REST API时获取curl错误

使用Bitbucket REST API时获取curl错误,rest,api,curl,bitbucket,bitbucket-api,Rest,Api,Curl,Bitbucket,Bitbucket Api,我正在尝试使用Bitbucket Rest API和curl命令创建一个分支,如下所示 curl-X POST-u:https://api.bitbucket.org/2.0/repositories/projectname/reponame“-d”{“scm”:“git”,“is_private”:“true”,“fork_policy”:“no_public_forks”,“project”:{“name”:“release1”}}” 下面是我为curl命令输出想到的: url: (6) C

我正在尝试使用Bitbucket Rest API和curl命令创建一个分支,如下所示

curl-X POST-u:https://api.bitbucket.org/2.0/repositories/projectname/reponame“-d”{“scm”:“git”,“is_private”:“true”,“fork_policy”:“no_public_forks”,“project”:{“name”:“release1”}}”

下面是我为curl命令输出想到的:

url: (6) Couldn't resolve host 'git,'
curl: (6) Couldn't resolve host 'is_private'
curl: (6) Couldn't resolve host 'true,'
curl: (6) Couldn't resolve host 'fork_policy'
curl: (6) Couldn't resolve host 'no_public_forks,'
curl: (6) Couldn't resolve host 'project'
curl: (3) [globbing] unmatched brace in column 1
curl: (3) [globbing] unmatched close brace/bracket in column 14
curl: (3) [globbing] unmatched close brace/bracket in column 1
请您帮助我在哪里丢失或更正curl命令以创建分支


提前感谢

来自
curl
的输出看起来似乎是参数解析有问题。请像这样再试一次:

curl -X POST -u <username>:<rest api token> "https://api.bitbucket.org/2.0/repositories/projectname/reponame" -d "{\"scm\": \"git\", \"is_private\": \"true\", \"fork_policy\": \"no_public_forks\", \"project\": {\"name\": \"release1\"} }"
curl-X POST-u:https://api.bitbucket.org/2.0/repositories/projectname/reponame“-d”{“scm\”:“git\”,“is\u private\”:“true\”,“fork\u policy\”:“no\u public\u forks\”,“project\”:{“name\”:“release1\”}”

根据您使用的操作系统和终端,参数解析的行为会有所不同。

curl
的输出看来,参数解析存在问题。请像这样再试一次:

curl -X POST -u <username>:<rest api token> "https://api.bitbucket.org/2.0/repositories/projectname/reponame" -d "{\"scm\": \"git\", \"is_private\": \"true\", \"fork_policy\": \"no_public_forks\", \"project\": {\"name\": \"release1\"} }"
curl-X POST-u:https://api.bitbucket.org/2.0/repositories/projectname/reponame“-d”{“scm\”:“git\”,“is\u private\”:“true\”,“fork\u policy\”:“no\u public\u forks\”,“project\”:{“name\”:“release1\”}”

根据您使用的操作系统和终端,参数解析的行为会有所不同。

您是否尝试过这一点:API文档缺少一个可以理解的示例。你能在使用RESTAPI时提供这个命令吗?我得到了401,不知道为什么。你试过这个吗:API文档缺少一个理解的例子。你能在使用RESTAPI时提供这个命令吗?我得到了401,不知道为什么。