2016-10-05 6 views
1

私は元のリポジトリの名前を取得するのに苦労しています。名前)と特定のユーザー名(最初はフォークされています)。Github API(v3)を使用してソースGitHubリポジトリの名前を取得する方法

https://api.github.com/users/:user/repos API呼び出しを使用しようとしましたが、この情報は含まれていません。あなたはフォークレポのユーザ名と名前を持っている場合

答えて

0

あなたはリポジトリ名とユーザー名を持っていますか?私たちができることを見てみましょう。

APIは、あなたが行うことができ、特定のリポジトリについてあなたに戻りますすべての情報を取得するには:

GET https://api.github.com/repos/:username/:repository_name 

これは、あなた

{ 
    "id": 1296269, 
    "owner": { 
    "login": "octocat", 
    "id": 1, 
    "avatar_url": "https://github.com/images/error/octocat_happy.gif", 
    "gravatar_id": "", 
    "url": "https://api.github.com/users/octocat", 
    "html_url": "https://github.com/octocat", 
    "followers_url": "https://api.github.com/users/octocat/followers", 
    "following_url": "https://api.github.com/users/octocat/following{/other_user}", 
    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", 
    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", 
    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", 
    "organizations_url": "https://api.github.com/users/octocat/orgs", 
    "repos_url": "https://api.github.com/users/octocat/repos", 
    "events_url": "https://api.github.com/users/octocat/events{/privacy}", 
    "received_events_url": "https://api.github.com/users/octocat/received_events", 
    "type": "User", 
    "site_admin": false 
    }, 
    "name": "Hello-World", 
    "full_name": "octocat/Hello-World", 
    "description": "This your first repo!", 
    "private": false, 
    "fork": false, 
    "url": "https://api.github.com/repos/octocat/Hello-World", 
    "html_url": "https://github.com/octocat/Hello-World", 
    "archive_url": "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}", 
    "assignees_url": "http://api.github.com/repos/octocat/Hello-World/assignees{/user}", 
    "blobs_url": "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}", 
    "branches_url": "http://api.github.com/repos/octocat/Hello-World/branches{/branch}", 
    "clone_url": "https://github.com/octocat/Hello-World.git", 
    "collaborators_url": "http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}", 
    "comments_url": "http://api.github.com/repos/octocat/Hello-World/comments{/number}", 
    "commits_url": "http://api.github.com/repos/octocat/Hello-World/commits{/sha}", 
    "compare_url": "http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}", 
    "contents_url": "http://api.github.com/repos/octocat/Hello-World/contents/{+path}", 
    "contributors_url": "http://api.github.com/repos/octocat/Hello-World/contributors", 
    "deployments_url": "http://api.github.com/repos/octocat/Hello-World/deployments", 
    "downloads_url": "http://api.github.com/repos/octocat/Hello-World/downloads", 
    "events_url": "http://api.github.com/repos/octocat/Hello-World/events", 
    "forks_url": "http://api.github.com/repos/octocat/Hello-World/forks", 
    "git_commits_url": "http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}", 
    "git_refs_url": "http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}", 
    "git_tags_url": "http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}", 
    "git_url": "git:github.com/octocat/Hello-World.git", 
    "hooks_url": "http://api.github.com/repos/octocat/Hello-World/hooks", 
    "issue_comment_url": "http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}", 
    "issue_events_url": "http://api.github.com/repos/octocat/Hello-World/issues/events{/number}", 
    "issues_url": "http://api.github.com/repos/octocat/Hello-World/issues{/number}", 
    "keys_url": "http://api.github.com/repos/octocat/Hello-World/keys{/key_id}", 
    "labels_url": "http://api.github.com/repos/octocat/Hello-World/labels{/name}", 
    "languages_url": "http://api.github.com/repos/octocat/Hello-World/languages", 
    "merges_url": "http://api.github.com/repos/octocat/Hello-World/merges", 
    "milestones_url": "http://api.github.com/repos/octocat/Hello-World/milestones{/number}", 
    "mirror_url": "git:git.example.com/octocat/Hello-World", 
    "notifications_url": "http://api.github.com/repos/octocat/Hello-World/notifications{?since, all, participating}", 
    "pulls_url": "http://api.github.com/repos/octocat/Hello-World/pulls{/number}", 
    "releases_url": "http://api.github.com/repos/octocat/Hello-World/releases{/id}", 
    "ssh_url": "[email protected]:octocat/Hello-World.git", 
    "stargazers_url": "http://api.github.com/repos/octocat/Hello-World/stargazers", 
    "statuses_url": "http://api.github.com/repos/octocat/Hello-World/statuses/{sha}", 
    "subscribers_url": "http://api.github.com/repos/octocat/Hello-World/subscribers", 
    "subscription_url": "http://api.github.com/repos/octocat/Hello-World/subscription", 
    "svn_url": "https://svn.github.com/octocat/Hello-World", 
    "tags_url": "http://api.github.com/repos/octocat/Hello-World/tags", 
    "teams_url": "http://api.github.com/repos/octocat/Hello-World/teams", 
    "trees_url": "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}", 
    "homepage": "https://github.com", 
    "language": null, 
    "forks_count": 9, 
    "stargazers_count": 80, 
    "watchers_count": 80, 
    "size": 108, 
    "default_branch": "master", 
    "open_issues_count": 0, 
    "has_issues": true, 
    "has_wiki": true, 
    "has_pages": false, 
    "has_downloads": true, 
    "pushed_at": "2011-01-26T19:06:43Z", 
    "created_at": "2011-01-26T19:01:12Z", 
    "updated_at": "2011-01-26T19:14:43Z", 
    "permissions": { 
    "admin": false, 
    "push": false, 
    "pull": true 
    }, 
    "subscribers_count": 42, 
    "organization": { 
     ... 
    }, 
    "parent": { 
    "id": 1296269, 
    "owner": { 
     "login": "octocat", 
     "id": 1, 
     "avatar_url": "https://github.com/images/error/octocat_happy.gif", 
     "gravatar_id": "", 
     "url": "https://api.github.com/users/octocat", 
     "html_url": "https://github.com/octocat", 
     "followers_url": "https://api.github.com/users/octocat/followers", 
     "following_url": "https://api.github.com/users/octocat/following{/other_user}", 
     "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", 
     "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", 
     "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", 
     "organizations_url": "https://api.github.com/users/octocat/orgs", 
     "repos_url": "https://api.github.com/users/octocat/repos", 
     "events_url": "https://api.github.com/users/octocat/events{/privacy}", 
     "received_events_url": "https://api.github.com/users/octocat/received_events", 
     "type": "User", 
     "site_admin": false 
    }, 
    "name": "Hello-World", 
    "full_name": "octocat/Hello-World", 
    "description": "This your first repo!", 
    "private": false, 
    "fork": true, 
    "url": "https://api.github.com/repos/octocat/Hello-World", 
    "html_url": "https://github.com/octocat/Hello-World", 
    "archive_url": "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}", 
    "assignees_url": "http://api.github.com/repos/octocat/Hello-World/assignees{/user}", 
    "blobs_url": "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}", 
    "branches_url": "http://api.github.com/repos/octocat/Hello-World/branches{/branch}", 
    "clone_url": "https://github.com/octocat/Hello-World.git", 
    "collaborators_url": "http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}", 
    "comments_url": "http://api.github.com/repos/octocat/Hello-World/comments{/number}", 
    "commits_url": "http://api.github.com/repos/octocat/Hello-World/commits{/sha}", 
    "compare_url": "http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}", 
    "contents_url": "http://api.github.com/repos/octocat/Hello-World/contents/{+path}", 
    "contributors_url": "http://api.github.com/repos/octocat/Hello-World/contributors", 
    "deployments_url": "http://api.github.com/repos/octocat/Hello-World/deployments", 
    "downloads_url": "http://api.github.com/repos/octocat/Hello-World/downloads", 
    "events_url": "http://api.github.com/repos/octocat/Hello-World/events", 
    "forks_url": "http://api.github.com/repos/octocat/Hello-World/forks", 
    "git_commits_url": "http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}", 
    "git_refs_url": "http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}", 
    "git_tags_url": "http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}", 
    "git_url": "git:github.com/octocat/Hello-World.git", 
    "hooks_url": "http://api.github.com/repos/octocat/Hello-World/hooks", 
    "issue_comment_url": "http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}", 
    "issue_events_url": "http://api.github.com/repos/octocat/Hello-World/issues/events{/number}", 
    "issues_url": "http://api.github.com/repos/octocat/Hello-World/issues{/number}", 
    "keys_url": "http://api.github.com/repos/octocat/Hello-World/keys{/key_id}", 
    "labels_url": "http://api.github.com/repos/octocat/Hello-World/labels{/name}", 
    "languages_url": "http://api.github.com/repos/octocat/Hello-World/languages", 
    "merges_url": "http://api.github.com/repos/octocat/Hello-World/merges", 
    "milestones_url": "http://api.github.com/repos/octocat/Hello-World/milestones{/number}", 
    "mirror_url": "git:git.example.com/octocat/Hello-World", 
    "notifications_url": "http://api.github.com/repos/octocat/Hello-World/notifications{?since, all, participating}", 
    "pulls_url": "http://api.github.com/repos/octocat/Hello-World/pulls{/number}", 
    "releases_url": "http://api.github.com/repos/octocat/Hello-World/releases{/id}", 
    "ssh_url": "[email protected]:octocat/Hello-World.git", 
    "stargazers_url": "http://api.github.com/repos/octocat/Hello-World/stargazers", 
    "statuses_url": "http://api.github.com/repos/octocat/Hello-World/statuses/{sha}", 
    "subscribers_url": "http://api.github.com/repos/octocat/Hello-World/subscribers", 
    "subscription_url": "http://api.github.com/repos/octocat/Hello-World/subscription", 
    "svn_url": "https://svn.github.com/octocat/Hello-World", 
    "tags_url": "http://api.github.com/repos/octocat/Hello-World/tags", 
    "teams_url": "http://api.github.com/repos/octocat/Hello-World/teams", 
    "trees_url": "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}", 
    "homepage": "https://github.com", 
    "language": null, 
    "forks_count": 9, 
    "stargazers_count": 80, 
    "watchers_count": 80, 
    "size": 108, 
    "default_branch": "master", 
    "open_issues_count": 0, 
    "has_issues": true, 
    "has_wiki": true, 
    "has_pages": false, 
    "has_downloads": true, 
    "pushed_at": "2011-01-26T19:06:43Z", 
    "created_at": "2011-01-26T19:01:12Z", 
    "updated_at": "2011-01-26T19:14:43Z", 
    "permissions": { 
     "admin": false, 
     "push": false, 
     "pull": true 
    } 
    }, 
    "source": { 
    "id": 1296269, 
    "owner": { 
     "login": "octocat", 
     "id": 1, 
     "avatar_url": "https://github.com/images/error/octocat_happy.gif", 
     "gravatar_id": "", 
     "url": "https://api.github.com/users/octocat", 
     "html_url": "https://github.com/octocat", 
     "followers_url": "https://api.github.com/users/octocat/followers", 
     "following_url": "https://api.github.com/users/octocat/following{/other_user}", 
     "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", 
     "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", 
     "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", 
     "organizations_url": "https://api.github.com/users/octocat/orgs", 
     "repos_url": "https://api.github.com/users/octocat/repos", 
     "events_url": "https://api.github.com/users/octocat/events{/privacy}", 
     "received_events_url": "https://api.github.com/users/octocat/received_events", 
     "type": "User", 
     "site_admin": false 
    }, 
    "name": "Hello-World", 
    "full_name": "octocat/Hello-World", 
    "description": "This your first repo!", 
    "private": false, 
    "fork": true, 
    "url": "https://api.github.com/repos/octocat/Hello-World", 
    "html_url": "https://github.com/octocat/Hello-World", 
    "archive_url": "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}", 
    "assignees_url": "http://api.github.com/repos/octocat/Hello-World/assignees{/user}", 
    "blobs_url": "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}", 
    "branches_url": "http://api.github.com/repos/octocat/Hello-World/branches{/branch}", 
    "clone_url": "https://github.com/octocat/Hello-World.git", 
    "collaborators_url": "http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}", 
    "comments_url": "http://api.github.com/repos/octocat/Hello-World/comments{/number}", 
    "commits_url": "http://api.github.com/repos/octocat/Hello-World/commits{/sha}", 
    "compare_url": "http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}", 
    "contents_url": "http://api.github.com/repos/octocat/Hello-World/contents/{+path}", 
    "contributors_url": "http://api.github.com/repos/octocat/Hello-World/contributors", 
    "deployments_url": "http://api.github.com/repos/octocat/Hello-World/deployments", 
    "downloads_url": "http://api.github.com/repos/octocat/Hello-World/downloads", 
    "events_url": "http://api.github.com/repos/octocat/Hello-World/events", 
    "forks_url": "http://api.github.com/repos/octocat/Hello-World/forks", 
    "git_commits_url": "http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}", 
    "git_refs_url": "http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}", 
    "git_tags_url": "http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}", 
    "git_url": "git:github.com/octocat/Hello-World.git", 
    "hooks_url": "http://api.github.com/repos/octocat/Hello-World/hooks", 
    "issue_comment_url": "http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}", 
    "issue_events_url": "http://api.github.com/repos/octocat/Hello-World/issues/events{/number}", 
    "issues_url": "http://api.github.com/repos/octocat/Hello-World/issues{/number}", 
    "keys_url": "http://api.github.com/repos/octocat/Hello-World/keys{/key_id}", 
    "labels_url": "http://api.github.com/repos/octocat/Hello-World/labels{/name}", 
    "languages_url": "http://api.github.com/repos/octocat/Hello-World/languages", 
    "merges_url": "http://api.github.com/repos/octocat/Hello-World/merges", 
    "milestones_url": "http://api.github.com/repos/octocat/Hello-World/milestones{/number}", 
    "mirror_url": "git:git.example.com/octocat/Hello-World", 
    "notifications_url": "http://api.github.com/repos/octocat/Hello-World/notifications{?since, all, participating}", 
    "pulls_url": "http://api.github.com/repos/octocat/Hello-World/pulls{/number}", 
    "releases_url": "http://api.github.com/repos/octocat/Hello-World/releases{/id}", 
    "ssh_url": "[email protected]:octocat/Hello-World.git", 
    "stargazers_url": "http://api.github.com/repos/octocat/Hello-World/stargazers", 
    "statuses_url": "http://api.github.com/repos/octocat/Hello-World/statuses/{sha}", 
    "subscribers_url": "http://api.github.com/repos/octocat/Hello-World/subscribers", 
    "subscription_url": "http://api.github.com/repos/octocat/Hello-World/subscription", 
    "svn_url": "https://svn.github.com/octocat/Hello-World", 
    "tags_url": "http://api.github.com/repos/octocat/Hello-World/tags", 
    "teams_url": "http://api.github.com/repos/octocat/Hello-World/teams", 
    "trees_url": "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}", 
    "homepage": "https://github.com", 
    "language": null, 
    "forks_count": 9, 
    "stargazers_count": 80, 
    "watchers_count": 80, 
    "size": 108, 
    "default_branch": "master", 
    "open_issues_count": 0, 
    "has_issues": true, 
    "has_wiki": true, 
    "has_pages": false, 
    "has_downloads": true, 
    "pushed_at": "2011-01-26T19:06:43Z", 
    "created_at": "2011-01-26T19:01:12Z", 
    "updated_at": "2011-01-26T19:14:43Z", 
    "permissions": { 
     "admin": false, 
     "push": false, 
     "pull": true 
    } 
    } 
} 

しかし、本当に私たちのように見えるデータを提供しますここに集中したいと思っています:

"parent": { 
    "id": 1296269, 
    "owner": { 
     "login": "octocat", 
     "id": 1, 
     "avatar_url": "https://github.com/images/error/octocat_happy.gif", 
     "gravatar_id": "", 
     "url": "https://api.github.com/users/octocat", 
     "html_url": "https://github.com/octocat", 
     "followers_url": "https://api.github.com/users/octocat/followers", 
     "following_url": "https://api.github.com/users/octocat/following{/other_user}", 
     "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", 
     "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", 
     "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", 
     "organizations_url": "https://api.github.com/users/octocat/orgs", 
     "repos_url": "https://api.github.com/users/octocat/repos", 
     "events_url": "https://api.github.com/users/octocat/events{/privacy}", 
     "received_events_url": "https://api.github.com/users/octocat/received_events", 
     "type": "User", 
     "site_admin": false 
    }, 
    "name": "Hello-World", 
    "full_name": "octocat/Hello-World", 
    "description": "This your first repo!", 
    "private": false, 
    "fork": true, 
    "url": "https://api.github.com/repos/octocat/Hello-World", 
    "html_url": "https://github.com/octocat/Hello-World", 
    "archive_url": "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}", 
    "assignees_url": "http://api.github.com/repos/octocat/Hello-World/assignees{/user}", 
    "blobs_url": "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}", 
    "branches_url": "http://api.github.com/repos/octocat/Hello-World/branches{/branch}", 
    "clone_url": "https://github.com/octocat/Hello-World.git", 
    "collaborators_url": "http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}", 
    "comments_url": "http://api.github.com/repos/octocat/Hello-World/comments{/number}", 
    "commits_url": "http://api.github.com/repos/octocat/Hello-World/commits{/sha}", 
    "compare_url": "http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}", 
    "contents_url": "http://api.github.com/repos/octocat/Hello-World/contents/{+path}", 
    "contributors_url": "http://api.github.com/repos/octocat/Hello-World/contributors", 
    "deployments_url": "http://api.github.com/repos/octocat/Hello-World/deployments", 
    "downloads_url": "http://api.github.com/repos/octocat/Hello-World/downloads", 
    "events_url": "http://api.github.com/repos/octocat/Hello-World/events", 
    "forks_url": "http://api.github.com/repos/octocat/Hello-World/forks", 
    "git_commits_url": "http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}", 
    "git_refs_url": "http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}", 
    "git_tags_url": "http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}", 
    "git_url": "git:github.com/octocat/Hello-World.git", 
    "hooks_url": "http://api.github.com/repos/octocat/Hello-World/hooks", 
    "issue_comment_url": "http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}", 
    "issue_events_url": "http://api.github.com/repos/octocat/Hello-World/issues/events{/number}", 
    "issues_url": "http://api.github.com/repos/octocat/Hello-World/issues{/number}", 
    "keys_url": "http://api.github.com/repos/octocat/Hello-World/keys{/key_id}", 
    "labels_url": "http://api.github.com/repos/octocat/Hello-World/labels{/name}", 
    "languages_url": "http://api.github.com/repos/octocat/Hello-World/languages", 
    "merges_url": "http://api.github.com/repos/octocat/Hello-World/merges", 
    "milestones_url": "http://api.github.com/repos/octocat/Hello-World/milestones{/number}", 
    "mirror_url": "git:git.example.com/octocat/Hello-World", 
    "notifications_url": "http://api.github.com/repos/octocat/Hello-World/notifications{?since, all, participating}", 
    "pulls_url": "http://api.github.com/repos/octocat/Hello-World/pulls{/number}", 
    "releases_url": "http://api.github.com/repos/octocat/Hello-World/releases{/id}", 
    "ssh_url": "[email protected]:octocat/Hello-World.git", 
    "stargazers_url": "http://api.github.com/repos/octocat/Hello-World/stargazers", 
    "statuses_url": "http://api.github.com/repos/octocat/Hello-World/statuses/{sha}", 
    "subscribers_url": "http://api.github.com/repos/octocat/Hello-World/subscribers", 
    "subscription_url": "http://api.github.com/repos/octocat/Hello-World/subscription", 
    "svn_url": "https://svn.github.com/octocat/Hello-World", 
    "tags_url": "http://api.github.com/repos/octocat/Hello-World/tags", 
    "teams_url": "http://api.github.com/repos/octocat/Hello-World/teams", 
    "trees_url": "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}", 
    "homepage": "https://github.com", 
    "language": null, 
    "forks_count": 9, 
    "stargazers_count": 80, 
    "watchers_count": 80, 
    "size": 108, 
    "default_branch": "master", 
    "open_issues_count": 0, 
    "has_issues": true, 
    "has_wiki": true, 
    "has_pages": false, 
    "has_downloads": true, 
    "pushed_at": "2011-01-26T19:06:43Z", 
    "created_at": "2011-01-26T19:01:12Z", 
    "updated_at": "2011-01-26T19:14:43Z", 
    "permissions": { 
     "admin": false, 
     "push": false, 
     "pull": true 
    } 
    }, 
    "source": { 
    "id": 1296269, 
    "owner": { 
     "login": "octocat", 
     "id": 1, 
     "avatar_url": "https://github.com/images/error/octocat_happy.gif", 
     "gravatar_id": "", 
     "url": "https://api.github.com/users/octocat", 
     "html_url": "https://github.com/octocat", 
     "followers_url": "https://api.github.com/users/octocat/followers", 
     "following_url": "https://api.github.com/users/octocat/following{/other_user}", 
     "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", 
     "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", 
     "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", 
     "organizations_url": "https://api.github.com/users/octocat/orgs", 
     "repos_url": "https://api.github.com/users/octocat/repos", 
     "events_url": "https://api.github.com/users/octocat/events{/privacy}", 
     "received_events_url": "https://api.github.com/users/octocat/received_events", 
     "type": "User", 
     "site_admin": false 
    }, 
    "name": "Hello-World", 
    "full_name": "octocat/Hello-World", 
    "description": "This your first repo!", 
    "private": false, 
    "fork": true, 
    "url": "https://api.github.com/repos/octocat/Hello-World", 
    "html_url": "https://github.com/octocat/Hello-World", 
    "archive_url": "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}", 
    "assignees_url": "http://api.github.com/repos/octocat/Hello-World/assignees{/user}", 
    "blobs_url": "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}", 
    "branches_url": "http://api.github.com/repos/octocat/Hello-World/branches{/branch}", 
    "clone_url": "https://github.com/octocat/Hello-World.git", 
    "collaborators_url": "http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}", 
    "comments_url": "http://api.github.com/repos/octocat/Hello-World/comments{/number}", 
    "commits_url": "http://api.github.com/repos/octocat/Hello-World/commits{/sha}", 
    "compare_url": "http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}", 
    "contents_url": "http://api.github.com/repos/octocat/Hello-World/contents/{+path}", 
    "contributors_url": "http://api.github.com/repos/octocat/Hello-World/contributors", 
    "deployments_url": "http://api.github.com/repos/octocat/Hello-World/deployments", 
    "downloads_url": "http://api.github.com/repos/octocat/Hello-World/downloads", 
    "events_url": "http://api.github.com/repos/octocat/Hello-World/events", 
    "forks_url": "http://api.github.com/repos/octocat/Hello-World/forks", 
    "git_commits_url": "http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}", 
    "git_refs_url": "http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}", 
    "git_tags_url": "http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}", 
    "git_url": "git:github.com/octocat/Hello-World.git", 
    "hooks_url": "http://api.github.com/repos/octocat/Hello-World/hooks", 
    "issue_comment_url": "http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}", 
    "issue_events_url": "http://api.github.com/repos/octocat/Hello-World/issues/events{/number}", 
    "issues_url": "http://api.github.com/repos/octocat/Hello-World/issues{/number}", 
    "keys_url": "http://api.github.com/repos/octocat/Hello-World/keys{/key_id}", 
    "labels_url": "http://api.github.com/repos/octocat/Hello-World/labels{/name}", 
    "languages_url": "http://api.github.com/repos/octocat/Hello-World/languages", 
    "merges_url": "http://api.github.com/repos/octocat/Hello-World/merges", 
    "milestones_url": "http://api.github.com/repos/octocat/Hello-World/milestones{/number}", 
    "mirror_url": "git:git.example.com/octocat/Hello-World", 
    "notifications_url": "http://api.github.com/repos/octocat/Hello-World/notifications{?since, all, participating}", 
    "pulls_url": "http://api.github.com/repos/octocat/Hello-World/pulls{/number}", 
    "releases_url": "http://api.github.com/repos/octocat/Hello-World/releases{/id}", 
    "ssh_url": "[email protected]:octocat/Hello-World.git", 
    "stargazers_url": "http://api.github.com/repos/octocat/Hello-World/stargazers", 
    "statuses_url": "http://api.github.com/repos/octocat/Hello-World/statuses/{sha}", 
    "subscribers_url": "http://api.github.com/repos/octocat/Hello-World/subscribers", 
    "subscription_url": "http://api.github.com/repos/octocat/Hello-World/subscription", 
    "svn_url": "https://svn.github.com/octocat/Hello-World", 
    "tags_url": "http://api.github.com/repos/octocat/Hello-World/tags", 
    "teams_url": "http://api.github.com/repos/octocat/Hello-World/teams", 
    "trees_url": "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}", 
    "homepage": "https://github.com", 
    "language": null, 
    "forks_count": 9, 
    "stargazers_count": 80, 
    "watchers_count": 80, 
    "size": 108, 
    "default_branch": "master", 
    "open_issues_count": 0, 
    "has_issues": true, 
    "has_wiki": true, 
    "has_pages": false, 
    "has_downloads": true, 
    "pushed_at": "2011-01-26T19:06:43Z", 
    "created_at": "2011-01-26T19:01:12Z", 
    "updated_at": "2011-01-26T19:14:43Z", 
    "permissions": { 
     "admin": false, 
     "push": false, 
     "pull": true 
    } 
    } 

これらの2つの部分は、 t(誰かがフォークをフォークした場合)とフォークグラフのルートノードであるソースを指定します。それの内部ownerオブジェクトなどのnameを持っている

body['source'] 

それでは、あなたは上記のGET要求から解析されたこのJSON本体を持っているとしましょう、あなたはそうのようなソースにアクセスすることができますリポジトリあなたが行うことができますので:

body['source']['owner']['login'] 

を、ソースを所有する個人または組織のユーザ名と

を取得するには
body['source']['name'] 

ソースのリポジトリ名を確認します。

+0

ありがとう@ sigmavirus24!私は昨日このエンドポイントを試しましたが、情報を完全に逃しました。 :) –

0

、あなたが呼び出すことができます。

GET /repos/:user/:name 

parentsourceフィールドの両方が含まれますJSONペイロードを返すように。 the documentationから:リポジトリフォークとき

parentsourceオブジェクトが存在しています。 parentは、このリポジトリがフォークされたリポジトリであり、sourceはネットワークの究極のソースです。

+0

ありがとうございます@kfb。これは本当に役に立ちます! :) –

関連する問題