С Github Enterprise у нас есть несколько различных URL-адресов API, которые мы все можем аутентифицировать с помощью комбинации имени пользователя / пароля:
curl -i https://github.mycompany.com/api/v3 -u my_git_username:@my_password
или с помощью Github Auth Token:
curl -H "Authorization: token 123a42s67f38g45hh67aj89a014sd11fhh444ee1" https://github.mycompany.com/api/v3
Независимо от того, какой метод аутентификации вы выберете, выходные данные запроса curl
одинаковы, и он копируется / вставляется ниже:
{
"current_user_url": "https://github.mycompany.com/api/v3/user",
"current_user_authorizations_html_url": "https://github.mycompany.com/settings/connections/applications{/client_id}",
"authorizations_url": "https://github.mycompany.com/api/v3/authorizations",
"code_search_url": "https://github.mycompany.com/api/v3/search/code?q={query}{&page,per_page,sort,order}",
"commit_search_url": "https://github.mycompany.com/api/v3/search/commits?q={query}{&page,per_page,sort,order}",
"emails_url": "https://github.mycompany.com/api/v3/user/emails",
"emojis_url": "https://github.mycompany.com/api/v3/emojis",
"events_url": "https://github.mycompany.com/api/v3/events",
"feeds_url": "https://github.mycompany.com/api/v3/feeds",
"followers_url": "https://github.mycompany.com/api/v3/user/followers",
"following_url": "https://github.mycompany.com/api/v3/user/following{/target}",
"gists_url": "https://github.mycompany.com/api/v3/gists{/gist_id}",
"hub_url": "https://github.mycompany.com/api/v3/hub",
"issue_search_url": "https://github.mycompany.com/api/v3/search/issues?q={query}{&page,per_page,sort,order}",
"issues_url": "https://github.mycompany.com/api/v3/issues",
"keys_url": "https://github.mycompany.com/api/v3/user/keys",
"notifications_url": "https://github.mycompany.com/api/v3/notifications",
"organization_repositories_url": "https://github.mycompany.com/api/v3/orgs/{org}/repos{?type,page,per_page,sort}",
"organization_url": "https://github.mycompany.com/api/v3/orgs/{org}",
"public_gists_url": "https://github.mycompany.com/api/v3/gists/public",
"rate_limit_url": "https://github.mycompany.com/api/v3/rate_limit",
"repository_url": "https://github.mycompany.com/api/v3/repos/{owner}/{repo}",
"repository_search_url": "https://github.mycompany.com/api/v3/search/repositories?q={query}{&page,per_page,sort,order}",
"current_user_repositories_url": "https://github.mycompany.com/api/v3/user/repos{?type,page,per_page,sort}",
"starred_url": "https://github.mycompany.com/api/v3/user/starred{/owner}{/repo}",
"starred_gists_url": "https://github.mycompany.com/api/v3/gists/starred",
"team_url": "https://github.mycompany.com/api/v3/teams",
"user_url": "https://github.mycompany.com/api/v3/users/{user}",
"user_organizations_url": "https://github.mycompany.com/api/v3/user/orgs",
"user_repositories_url": "https://github.mycompany.com/api/v3/users/{user}/repos{?type,page,per_page,sort}",
"user_search_url": "https://github.mycompany.com/api/v3/search/users?q={query}{&page,per_page,sort,order}"
}
`
Чтобы запросить запрос на извлечение, укажите запрос curl
с URL-адресом. который содержит номер запроса на извлечение (:number
), имя хранилища (:repo
) и MyTeamName (:owner
):
curl -u my_git_username:@my_password -H "Accept: application/vnd.github.shadow-cat-preview+json" https://github.mycompany.com/api/v3/repos/MyTeamName/MyRepoName/pulls/3
или с использованием Github Auth Token:
curl -H "Authorization: token 123a42s67f38g45hh67aj89a014sd11fhh444ee1" -H "Accept: application/vnd.github.shadow-cat-preview+json" https://github.mycompany.com/api/v3/repos/MyTeamName/MyRepoName/pulls/3