Github API error - { "message": "Not Found", "documentation_url": "https://developer.github.com/v3" } making repo in cURL terminal

Viewed 10213

api is v3, the reason that I am trying to make a tool so that when you input your username and password for github and the repo name and description, it will initialize the repo and give you the url. My input is this -

curl -u {myuser}:{mypassword} -H "Content-Type: application/json" -d '{"name":"api-test","description":"made with github api","homepage": "https://github.com","private":true}' POST https://api.github.com/users/{myuser}/repos

I get the response

{
  "message": "Not Found",
  "documentation_url": "https://developer.github.com/v3"
}

. The docs say this : Creates a new repository for the authenticated user. POST /user/repos. https://developer.github.com/v3/repos/#create. I am very new to github-api, and thankful for help.

2 Answers

See this curl tutorial for your GitHub API calls

POST

Use the --request (-X) flag along with --data (-d) to POST data

curl --user "caspyin" --request POST --data '{"description":"Created via API","public":"true","files":{"file1.txt":{"content":"Demo"}}' https://api.github.com/gists

curl --user "caspyin" -X POST --data '{"description":"Created via API","public":"true","files":{"file1.txt":{"content":"Demo"}}' https://api.github.com/gists

Of course --data implies POST so you don't have to also specify the --request flag

curl --user "caspyin" --data '{"description":"Created via API","public":"true","files":{"file1.txt":{"content":"Demo"}}' https://api.github.com/gists

ok i got it. I just used the wrong url. This is what I did

curl --user "{user}:{password}" -X POST -d '{"name":"api-test","description":"made with github api","private":"true","homepage":"https://github.com"}' \\ https://api.github.com/user/repos // <- IMPORTANT PART
Related