title: GitHub API to Create a File
body: <p>So I'm trying to familiarize myself with the GitHub API. I'm using cURL commands to implement some of their basic functionality. I can get the basic authorization &amp; repository creation correctly. Currently, I'm trying to create a file in a repository using their API &amp; am facing the "message":"Not Found" error as the response.</p>
  
  <p>Their <a href="http://developer.github.com/v3/repos/contents/#create-a-file" rel="noreferrer">documentation</a> suggests this:</p>
  
  <pre><code>PUT /repos/:owner/:repo/contents/:path
  </code></pre>
  
  <p>I came up with this as the cURL equivalent:</p>
  
  <pre><code>curl -H 'Authorization: &lt;token&gt;' -d '{"path": "test.txt", "message": "Initial Commit", "committer": {"name": "&lt;name&gt;", "email": "&lt;email&gt;"}, "content": "bXkgbmV3IGZpbGUgY29udGVudHM=", "note":"Test Commit"}' https://api.github.com/repos/InViN-test/test_repo1/contents/test.txt
  </code></pre>
  
  <p>I think the problem is with the API URL I'm using at the end, but I can't seem to figure out what the URL should look like.</p>
  
  <p>This is what I used to create a repository:</p>
  
  <pre><code>curl -i -H 'Authorization: &lt;token&gt;' -d '{"name": "test_repo1", "message": "Initial Commit", "committer": {"name": "&lt;name&gt;", "email": "&lt;email&gt;"}, "content": "bXkgbmV3IGZpbGUgY29udGVudHM=", "note":"Test Commit"}' https://api.github.com/user/repos
  </code></pre>
  
  <p>The repository creation URL I used follows: user/repos as the syntax.
  Similarly, I've tried using user/repos/repo, but it didn't work.</p>
  
  <p>Can anyone shed any light on this?</p>
  
  <p>I've gone through various StackOverflow questions &amp; many seem similar but none really offer an example so I can figure out where the mistake lies.</p>
  
  <p>EDIT: Thanks to TimWolla for the answer.</p>
  
  <p>Syntax of a working command to create a file in a repository using the GitHub API:</p>
  
  <p><code>curl -i -X PUT -H 'Authorization: token &lt;token_string&gt;' -d '{"path": "&lt;filename.extension&gt;", "message": "&lt;Commit Message&gt;", "committer": {"name": "&lt;Name&gt;", "email": "&lt;E-Mail&gt;"}, "content": "&lt;Base64 Encoded&gt;", "branch": "master"}' https://api.github.com/repos/&lt;owner&gt;/&lt;repository&gt;/contents/&lt;filename.extension&gt;</code></p>
  
  <p>My example:</p>
  
  <p><code>curl -i -X PUT -H 'Authorization: token f94ce61613d5613a23770b324521b63d202d5645' -d '{"path": "test4.txt", "message": "Initial Commit", "committer": {"name": "Neil", "email": "neil@abc.com"}, "content": "bXkgbmV3IGZpbGUgY29udGVudHM=", "branch": "master"}' https://api.github.com/repos/InViN-test/test_repo1/contents/test4.txt</code></p>