github api code example

Example 1: create a repo using github api

#On your Github account: go to Settings -> Developer Settings -> Personal Access Token Under OAuth Apps. 
#Now, Generate a New Access token with Required privileges enabled. Ignore This if you already have one. 
#Replace ACCESS_TOKEN with Token and NEW_REPO_NAME with your New Repository Name in the command below:

curl -H "Authorization: token ACCESS_TOKEN" --data '{"name":"NEW_REPO_NAME"}' https://api.github.com/user/repos

Example 2: Github API documentation

curl -u "username" https://api.github.com

Example 3: github.com developer

curl https://api.github.com/search/repositories?q=tetris+language:assembly&sort=stars&order=desc

Example 4: github gist api

GET /users/:username/gists

Example 5: github.com developer

GET /search/repositories

Example 6: authorization github api

Accept: application/json
{"access_token":"e72e16c7e42f292c6912e7710c838347ae178b4a", "scope":"repo,gist", "token_type":"bearer"}

Accept: application/xml
<OAuth>
  <token_type>bearer</token_type>
  <scope>repo,gist</scope>
  <access_token>e72e16c7e42f292c6912e7710c838347ae178b4a</access_token>
</OAuth>