我们经常发布文档更新,此页面的翻译可能仍在进行中。有关最新信息,请访问英文文档。如果此页面上的翻译有问题,请告诉我们

此版本的 GitHub Enterprise 已停止服务 2020-11-12. 即使针对重大安全问题,也不会发布补丁。 要获得更好的性能、改进的安全性和新功能,请升级到 GitHub Enterprise 的最新版本。 如需升级方面的帮助,请联系 GitHub Enterprise 支持

元数据

本文内容

GitHub API Root

Get Hypermedia links to resources accessible in GitHub's REST API

get /

代码示例

Shell
curl \
  -H "Accept: application/vnd.github.v3+json" \
  https://api.github.com/
JavaScript (@octokit/core.js)
await octokit.request('GET /')

Response

Status: 200 OK

Notes


Get GitHub Enterprise Server meta information

This endpoint provides a list of GitHub's IP addresses. For more information, see "About GitHub's IP addresses."

get /meta

代码示例

Shell
curl \
  -H "Accept: application/vnd.github.v3+json" \
  https://api.github.com/meta
JavaScript (@octokit/core.js)
await octokit.request('GET /meta')

Default response

Status: 200 OK
{
  "verifiable_password_authentication": true,
  "installed_version": "2.19.0",
  "github_services_sha": "3a0f86fb8db8eea7ccbb9a95f325ddbedfb25e15"
}

Not modified

Status: 304 Not Modified

Notes


Get Octocat

Get the octocat as ASCII art

get /octocat

参数

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended.

s string query

The words to show in Octocat's speech bubble

代码示例

Shell
curl \
  -H "Accept: application/vnd.github.v3+json" \
  https://api.github.com/octocat
JavaScript (@octokit/core.js)
await octokit.request('GET /octocat')

Response

Status: 200 OK

Notes


Get the Zen of GitHub

Get a random sentence from the Zen of GitHub

get /zen

代码示例

Shell
curl \
  -H "Accept: application/vnd.github.v3+json" \
  https://api.github.com/zen
JavaScript (@octokit/core.js)
await octokit.request('GET /zen')

Response

Status: 200 OK

Notes