使用 curl 编辑 GitHub 问题



尝试通过curl.exe(Windows命令行(在github上编辑问题,我不断收到以下错误。 有什么建议吗?

curl 命令

curl -X POST -u "someuser" https://api.github.com/repos/myrepo/myproject/issues/4 -d '{"labels": "["bug"]"}' -H "Content-Type: application/json"

错误信息

{
"message": "Problems parsing JSON",
"documentation_url": "https://developer.github.com/v3/issues/#edit-an-issue"
}

我最初的帖子是关于使用 curl 在 GitHub 中编辑问题。 我正在使用Windows命令行来做到这一点。 正如有人指出的那样,Windows 命令行中的'(单引号(不起作用。 在 Windows 命令外壳中,您必须对 字符串并转义任何内部双引号。

以下命令将通过 Windows 命令行工作。

窗口命令行

curl.exe -X POST -u "someuser" https://api.github.com/repos/myrepo/myproject/issues/4 -d "{"labels":["bug"]}" -H "Content-Type: application/json"

以下命令将通过 Linux bash 工作。

Linux Bash

curl -X POST -u "someuser" https://api.github.com/repos/myrepo/myproject/issues/4 -d '{"labels": ["bug"]}' -H "Content-Type: application/json"

最新更新