REST API v3: Not able to create repo using the code given in the guide

I used the code given here - - to create a repo using REST API v3. But it errors out with a message Problems parsing JSON. I have even replaced the OAuth token with my own. Can someone help me out?

Can you post your exact code or curl example (with OAuth tokens redacted) so we can see what you’re doing? Difficult to provide feedback without that.


@abinoda Heres the code -

curl -i -H "Authorization: token \<OAuth token\>" \ -d '{ \
        "name": "blog", \
        "auto_init": true, \
        "private": true, \
        "gitignore_template": "nanoc" \
      }' \

The above code gets the parsing JSON error.

But if I put everything in one line then the request works

The one line code - 

curl -i -H "Authorization: token <OAuth token>" -d '{"name": "blog", "auto_init": true, "private": true, "gitignore_template": "nanoc"}'`

Try this, I think it’s cleaner:

curl -i -X POST \
-H "Authorization: token <OAuth token>" \
-d @- << EOF
  "name": "blog",
  "auto_init": true,
  "private": true,
  "gitignore_template": "nanoc"

 @abinoda That worked, thx for the help.

I think that the guide should be updated as this was not the only code that had the same error.

Can i pass parameters like “created_at” “updated_at” “pushed_at” ? It says problems parsing json,

For me it only works as single line after many tries