I am trying to create a release using Github’s API.
My request works fine in Postman but no matter what I’ve tried it always fails with curl, including if I just translate my Postman request into curl using Postman.
This is the body of my Postman POST request:
{
"tag_name": "4.2.0",
"target_commitish": "master",
"name": "4.2.0",
"body": "test"
}
I’ve included an authorization header of type “Basic”, where I input my username and a token I have created for this purpose.
I am executing the request against https://api.github.com/repos/
.
As I said – it works fine, but when I translate it into curl I get the error “Problems parsing JSON”.
The translated curl command is:
curl --location --request POST 'https://api.github.com/repos///releases'
--header 'Authorization: Basic '
--header 'Content-Type: application/json'
--data-raw '{
"tag_name": "4.2.0",
"target_commitish": "master",
"name": "4.2.0",
"body": "test"
}'
which I reformat into curl --location --request POST 'https://api.github.com/repos/
to be on one line.
I also tried (since only the “tag_name” parameter is required):
curl -i -H 'Authorization: token
curl -i -H 'Authorization: token
curl -d '{"tag_name":"4.2.0"}' -u
curl -d "tag_name=4.2.0" -u
Every curl request fails with the “Problems parsing JSON” error.
Why would it work fine in Postman but not in curl?