Robert Thompson
Robert Thompson

Reputation: 43

Edit GitHub Issue with curl

Trying to edit an issue on github via curl.exe (Windows Command Line) and I keep getting the following error. Any suggestions?

curl command

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

error Message

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

Upvotes: 1

Views: 362

Answers (1)

Robert Thompson
Robert Thompson

Reputation: 43

My original post was about using curl to edit an issue in GitHub. I was using the Windows Command line to do it. As it was pointed out the ' (single quotes) in the Windows Command line was not going to work. In the Windows command shell you have to use outer double quotes for the string and escape any inner double quotes.

The following command will work via a Windows Command Line.

Windows Command Line

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

The following command will work via 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"

Upvotes: 1

Related Questions