Get GitHub Repository Information through REST API (in JSON Format)

Jun. 28, 2024

For a GitHub repository $REPO_NAME owned by user $USER_NAME, we can get its repository information through url https://api.github.com/repos/$USER_NAME/$REPO_NAME. For example, for the public repository hosting my personal website, through https://api.github.com/repos/HelloWorld-1017/HelloWorld-1017.github.io I have these following information in JSON (JavaScript Object Notation) data format (or, a JSON file):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
{
  "id": 514507239,
  "node_id": "R_kgDOHqrB5w",
  "name": "HelloWorld-1017.github.io",
  "full_name": "HelloWorld-1017/HelloWorld-1017.github.io",
  "private": false,
  "owner": {
    "login": "HelloWorld-1017",
    "id": 50327243,
    "node_id": "MDQ6VXNlcjUwMzI3MjQz",
    "avatar_url": "https://avatars.githubusercontent.com/u/50327243?v=4",
    "gravatar_id": "",
    "url": "https://api.github.com/users/HelloWorld-1017",
    "html_url": "https://github.com/HelloWorld-1017",
    "followers_url": "https://api.github.com/users/HelloWorld-1017/followers",
    "following_url": "https://api.github.com/users/HelloWorld-1017/following{/other_user}",
    "gists_url": "https://api.github.com/users/HelloWorld-1017/gists{/gist_id}",
    "starred_url": "https://api.github.com/users/HelloWorld-1017/starred{/owner}{/repo}",
    "subscriptions_url": "https://api.github.com/users/HelloWorld-1017/subscriptions",
    "organizations_url": "https://api.github.com/users/HelloWorld-1017/orgs",
    "repos_url": "https://api.github.com/users/HelloWorld-1017/repos",
    "events_url": "https://api.github.com/users/HelloWorld-1017/events{/privacy}",
    "received_events_url": "https://api.github.com/users/HelloWorld-1017/received_events",
    "type": "User",
    "site_admin": false
  },
  "html_url": "https://github.com/HelloWorld-1017/HelloWorld-1017.github.io",
  "description": "helloworld-1017.github.io",
  "fork": false,
  "url": "https://api.github.com/repos/HelloWorld-1017/HelloWorld-1017.github.io",
  "forks_url": "https://api.github.com/repos/HelloWorld-1017/HelloWorld-1017.github.io/forks",
  "keys_url": "https://api.github.com/repos/HelloWorld-1017/HelloWorld-1017.github.io/keys{/key_id}",
  "collaborators_url": "https://api.github.com/repos/HelloWorld-1017/HelloWorld-1017.github.io/collaborators{/collaborator}",
  "teams_url": "https://api.github.com/repos/HelloWorld-1017/HelloWorld-1017.github.io/teams",
  "hooks_url": "https://api.github.com/repos/HelloWorld-1017/HelloWorld-1017.github.io/hooks",
  "issue_events_url": "https://api.github.com/repos/HelloWorld-1017/HelloWorld-1017.github.io/issues/events{/number}",
  "events_url": "https://api.github.com/repos/HelloWorld-1017/HelloWorld-1017.github.io/events",
  "assignees_url": "https://api.github.com/repos/HelloWorld-1017/HelloWorld-1017.github.io/assignees{/user}",
  "branches_url": "https://api.github.com/repos/HelloWorld-1017/HelloWorld-1017.github.io/branches{/branch}",
  "tags_url": "https://api.github.com/repos/HelloWorld-1017/HelloWorld-1017.github.io/tags",
  "blobs_url": "https://api.github.com/repos/HelloWorld-1017/HelloWorld-1017.github.io/git/blobs{/sha}",
  "git_tags_url": "https://api.github.com/repos/HelloWorld-1017/HelloWorld-1017.github.io/git/tags{/sha}",
  "git_refs_url": "https://api.github.com/repos/HelloWorld-1017/HelloWorld-1017.github.io/git/refs{/sha}",
  "trees_url": "https://api.github.com/repos/HelloWorld-1017/HelloWorld-1017.github.io/git/trees{/sha}",
  "statuses_url": "https://api.github.com/repos/HelloWorld-1017/HelloWorld-1017.github.io/statuses/{sha}",
  "languages_url": "https://api.github.com/repos/HelloWorld-1017/HelloWorld-1017.github.io/languages",
  "stargazers_url": "https://api.github.com/repos/HelloWorld-1017/HelloWorld-1017.github.io/stargazers",
  "contributors_url": "https://api.github.com/repos/HelloWorld-1017/HelloWorld-1017.github.io/contributors",
  "subscribers_url": "https://api.github.com/repos/HelloWorld-1017/HelloWorld-1017.github.io/subscribers",
  "subscription_url": "https://api.github.com/repos/HelloWorld-1017/HelloWorld-1017.github.io/subscription",
  "commits_url": "https://api.github.com/repos/HelloWorld-1017/HelloWorld-1017.github.io/commits{/sha}",
  "git_commits_url": "https://api.github.com/repos/HelloWorld-1017/HelloWorld-1017.github.io/git/commits{/sha}",
  "comments_url": "https://api.github.com/repos/HelloWorld-1017/HelloWorld-1017.github.io/comments{/number}",
  "issue_comment_url": "https://api.github.com/repos/HelloWorld-1017/HelloWorld-1017.github.io/issues/comments{/number}",
  "contents_url": "https://api.github.com/repos/HelloWorld-1017/HelloWorld-1017.github.io/contents/{+path}",
  "compare_url": "https://api.github.com/repos/HelloWorld-1017/HelloWorld-1017.github.io/compare/{base}...{head}",
  "merges_url": "https://api.github.com/repos/HelloWorld-1017/HelloWorld-1017.github.io/merges",
  "archive_url": "https://api.github.com/repos/HelloWorld-1017/HelloWorld-1017.github.io/{archive_format}{/ref}",
  "downloads_url": "https://api.github.com/repos/HelloWorld-1017/HelloWorld-1017.github.io/downloads",
  "issues_url": "https://api.github.com/repos/HelloWorld-1017/HelloWorld-1017.github.io/issues{/number}",
  "pulls_url": "https://api.github.com/repos/HelloWorld-1017/HelloWorld-1017.github.io/pulls{/number}",
  "milestones_url": "https://api.github.com/repos/HelloWorld-1017/HelloWorld-1017.github.io/milestones{/number}",
  "notifications_url": "https://api.github.com/repos/HelloWorld-1017/HelloWorld-1017.github.io/notifications{?since,all,participating}",
  "labels_url": "https://api.github.com/repos/HelloWorld-1017/HelloWorld-1017.github.io/labels{/name}",
  "releases_url": "https://api.github.com/repos/HelloWorld-1017/HelloWorld-1017.github.io/releases{/id}",
  "deployments_url": "https://api.github.com/repos/HelloWorld-1017/HelloWorld-1017.github.io/deployments",
  "created_at": "2022-07-16T07:16:20Z",
  "updated_at": "2024-06-27T15:17:36Z",
  "pushed_at": "2024-06-27T15:17:32Z",
  "git_url": "git://github.com/HelloWorld-1017/HelloWorld-1017.github.io.git",
  "ssh_url": "git@github.com:HelloWorld-1017/HelloWorld-1017.github.io.git",
  "clone_url": "https://github.com/HelloWorld-1017/HelloWorld-1017.github.io.git",
  "svn_url": "https://github.com/HelloWorld-1017/HelloWorld-1017.github.io",
  "homepage": "https://helloworld-1017.github.io",
  "size": 986256,
  "stargazers_count": 4,
  "watchers_count": 4,
  "language": "JavaScript",
  "has_issues": true,
  "has_projects": true,
  "has_downloads": true,
  "has_wiki": true,
  "has_pages": true,
  "has_discussions": true,
  "forks_count": 0,
  "mirror_url": null,
  "archived": false,
  "disabled": false,
  "open_issues_count": 0,
  "license": null,
  "allow_forking": true,
  "is_template": false,
  "web_commit_signoff_required": false,
  "topics": [

  ],
  "visibility": "public",
  "forks": 0,
  "open_issues": 0,
  "watchers": 4,
  "default_branch": "main",
  "temp_clone_token": null,
  "network_count": 0,
  "subscribers_count": 3
}


References

[1] GitHub REST API documentation - GitHub Docs.