Back to top

Github API (Gophers example)

Repository

Create

Create
POST/user/repos

Creates a new repository for the authenticated user.

Example URI

POST https://api.github.com/user/repos
Request
HideShow
Headers
Content-Type: application/json
Body
{
  "name": "test-gophers-shyann"
}
Response  201
HideShow
Headers
Content-Length: 5183
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
Cache-Control: private, max-age=60, s-maxage=60
Content-Security-Policy: default-src 'none'
Content-Type: application/json; charset=utf-8
Date: Mon, 26 Sep 2016 12:42:06 GMT
Etag: "a50ac425e794f591a167974e6a75ac29"
Location: https://api.github.com/repos/go-gopher/test-gophers-shyann
Server: GitHub.com
Status: 201 Created
Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
Vary: Accept, Authorization, Cookie, X-GitHub-OTP
Vary: Accept-Encoding
X-Accepted-Oauth-Scopes: public_repo, repo
X-Content-Type-Options: nosniff
X-Frame-Options: deny
X-Github-Media-Type: github.v3; format=json
X-Github-Request-Id: B9297182:1729:86EED94:57E9179E
X-Oauth-Scopes: delete_repo, public_repo, read:org
X-Ratelimit-Limit: 5000
X-Ratelimit-Remaining: 4933
X-Ratelimit-Reset: 1474896817
X-Served-By: 9000e9eef7bb1e89f22030c676da140e
X-Xss-Protection: 1; mode=block
Body
{
  "archive_url": "https://api.github.com/repos/go-gopher/test-gophers-shyann/{archive_format}{/ref}",
  "assignees_url": "https://api.github.com/repos/go-gopher/test-gophers-shyann/assignees{/user}",
  "blobs_url": "https://api.github.com/repos/go-gopher/test-gophers-shyann/git/blobs{/sha}",
  "branches_url": "https://api.github.com/repos/go-gopher/test-gophers-shyann/branches{/branch}",
  "clone_url": "https://github.com/go-gopher/test-gophers-shyann.git",
  "collaborators_url": "https://api.github.com/repos/go-gopher/test-gophers-shyann/collaborators{/collaborator}",
  "comments_url": "https://api.github.com/repos/go-gopher/test-gophers-shyann/comments{/number}",
  "commits_url": "https://api.github.com/repos/go-gopher/test-gophers-shyann/commits{/sha}",
  "compare_url": "https://api.github.com/repos/go-gopher/test-gophers-shyann/compare/{base}...{head}",
  "contents_url": "https://api.github.com/repos/go-gopher/test-gophers-shyann/contents/{+path}",
  "contributors_url": "https://api.github.com/repos/go-gopher/test-gophers-shyann/contributors",
  "created_at": "2016-09-26T12:42:06Z",
  "default_branch": "master",
  "deployments_url": "https://api.github.com/repos/go-gopher/test-gophers-shyann/deployments",
  "description": null,
  "downloads_url": "https://api.github.com/repos/go-gopher/test-gophers-shyann/downloads",
  "events_url": "https://api.github.com/repos/go-gopher/test-gophers-shyann/events",
  "fork": false,
  "forks": 0,
  "forks_count": 0,
  "forks_url": "https://api.github.com/repos/go-gopher/test-gophers-shyann/forks",
  "full_name": "go-gopher/test-gophers-shyann",
  "git_commits_url": "https://api.github.com/repos/go-gopher/test-gophers-shyann/git/commits{/sha}",
  "git_refs_url": "https://api.github.com/repos/go-gopher/test-gophers-shyann/git/refs{/sha}",
  "git_tags_url": "https://api.github.com/repos/go-gopher/test-gophers-shyann/git/tags{/sha}",
  "git_url": "git://github.com/go-gopher/test-gophers-shyann.git",
  "has_downloads": true,
  "has_issues": true,
  "has_pages": false,
  "has_wiki": true,
  "homepage": null,
  "hooks_url": "https://api.github.com/repos/go-gopher/test-gophers-shyann/hooks",
  "html_url": "https://github.com/go-gopher/test-gophers-shyann",
  "id": 69248808,
  "issue_comment_url": "https://api.github.com/repos/go-gopher/test-gophers-shyann/issues/comments{/number}",
  "issue_events_url": "https://api.github.com/repos/go-gopher/test-gophers-shyann/issues/events{/number}",
  "issues_url": "https://api.github.com/repos/go-gopher/test-gophers-shyann/issues{/number}",
  "keys_url": "https://api.github.com/repos/go-gopher/test-gophers-shyann/keys{/key_id}",
  "labels_url": "https://api.github.com/repos/go-gopher/test-gophers-shyann/labels{/name}",
  "language": null,
  "languages_url": "https://api.github.com/repos/go-gopher/test-gophers-shyann/languages",
  "merges_url": "https://api.github.com/repos/go-gopher/test-gophers-shyann/merges",
  "milestones_url": "https://api.github.com/repos/go-gopher/test-gophers-shyann/milestones{/number}",
  "mirror_url": null,
  "name": "test-gophers-shyann",
  "network_count": 0,
  "notifications_url": "https://api.github.com/repos/go-gopher/test-gophers-shyann/notifications{?since,all,participating}",
  "open_issues": 0,
  "open_issues_count": 0,
  "owner": {
    "avatar_url": "https://avatars.githubusercontent.com/u/19872809?v=3",
    "events_url": "https://api.github.com/users/go-gopher/events{/privacy}",
    "followers_url": "https://api.github.com/users/go-gopher/followers",
    "following_url": "https://api.github.com/users/go-gopher/following{/other_user}",
    "gists_url": "https://api.github.com/users/go-gopher/gists{/gist_id}",
    "gravatar_id": "",
    "html_url": "https://github.com/go-gopher",
    "id": 19872809,
    "login": "go-gopher",
    "organizations_url": "https://api.github.com/users/go-gopher/orgs",
    "received_events_url": "https://api.github.com/users/go-gopher/received_events",
    "repos_url": "https://api.github.com/users/go-gopher/repos",
    "site_admin": false,
    "starred_url": "https://api.github.com/users/go-gopher/starred{/owner}{/repo}",
    "subscriptions_url": "https://api.github.com/users/go-gopher/subscriptions",
    "type": "User",
    "url": "https://api.github.com/users/go-gopher"
  },
  "permissions": {
    "admin": true,
    "pull": true,
    "push": true
  },
  "private": false,
  "pulls_url": "https://api.github.com/repos/go-gopher/test-gophers-shyann/pulls{/number}",
  "pushed_at": "2016-09-26T12:42:06Z",
  "releases_url": "https://api.github.com/repos/go-gopher/test-gophers-shyann/releases{/id}",
  "size": 0,
  "ssh_url": "git@github.com:go-gopher/test-gophers-shyann.git",
  "stargazers_count": 0,
  "stargazers_url": "https://api.github.com/repos/go-gopher/test-gophers-shyann/stargazers",
  "statuses_url": "https://api.github.com/repos/go-gopher/test-gophers-shyann/statuses/{sha}",
  "subscribers_count": 1,
  "subscribers_url": "https://api.github.com/repos/go-gopher/test-gophers-shyann/subscribers",
  "subscription_url": "https://api.github.com/repos/go-gopher/test-gophers-shyann/subscription",
  "svn_url": "https://github.com/go-gopher/test-gophers-shyann",
  "tags_url": "https://api.github.com/repos/go-gopher/test-gophers-shyann/tags",
  "teams_url": "https://api.github.com/repos/go-gopher/test-gophers-shyann/teams",
  "trees_url": "https://api.github.com/repos/go-gopher/test-gophers-shyann/git/trees{/sha}",
  "updated_at": "2016-09-26T12:42:06Z",
  "url": "https://api.github.com/repos/go-gopher/test-gophers-shyann",
  "watchers": 0,
  "watchers_count": 0
}
Response  422
HideShow
Headers
Content-Length: 215
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
Content-Security-Policy: default-src 'none'
Content-Type: application/json; charset=utf-8
Date: Mon, 26 Sep 2016 12:42:07 GMT
Server: GitHub.com
Status: 422 Unprocessable Entity
Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
X-Accepted-Oauth-Scopes: public_repo, repo
X-Content-Type-Options: nosniff
X-Frame-Options: deny
X-Github-Media-Type: github.v3; format=json
X-Github-Request-Id: B9297182:1729:86EEDE0:57E9179E
X-Oauth-Scopes: delete_repo, public_repo, read:org
X-Ratelimit-Limit: 5000
X-Ratelimit-Remaining: 4930
X-Ratelimit-Reset: 1474896817
X-Xss-Protection: 1; mode=block
Body
{
  "documentation_url": "https://developer.github.com/v3/repos/#create",
  "errors": [
    {
      "code": "custom",
      "field": "name",
      "message": "name already exists on this account",
      "resource": "Repository"
    }
  ],
  "message": "Validation Failed"
}

Generated by aglio on 26 Sep 2016