REST API ドキュメントの一部は最近移動されました。 探しているものが見つからない場合は、新しい Branches, Collaborators, Commits, Deploy Keys, Deployments, GitHub Pages, Releases, Metrics, Webhooks REST API ページを試してみてください。
ページ
REST API を使って、GitHub Pages サイトやビルドを操作できます。
Get a GitHub AE Pages site
Gets information about a GitHub AE Pages site.
A token with the repo scope is required. GitHub Apps must have the pages:read permission.
"Get a GitHub AE Pages site" のパラメーター
| 名前, Type, 説明 |
|---|
accept string Setting to |
| 名前, Type, 説明 |
|---|
owner string 必須The account owner of the repository. The name is not case sensitive. |
repo string 必須The name of the repository without the |
"Get a GitHub AE Pages site" の HTTP 応答状態コード
| 状態コード | 説明 |
|---|---|
200 | OK |
404 | Resource not found |
"Get a GitHub AE Pages site" のコード サンプル
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
https://HOSTNAME/api/v3/repos/OWNER/REPO/pagesResponse
Status: 200{
"url": "https://api.github.com/repos/github/developer.github.com/pages",
"status": "built",
"cname": "developer.github.com",
"custom_404": false,
"html_url": "https://developer.github.com",
"source": {
"branch": "master",
"path": "/"
},
"public": true,
"https_certificate": {
"state": "approved",
"description": "Certificate is approved",
"domains": [
"developer.github.com"
],
"expires_at": "2021-05-22"
},
"https_enforced": true
}Create a GitHub AE Pages site
Configures a GitHub AE Pages site. For more information, see "About GitHub Pages."
To use this endpoint, you must be a repository administrator, maintainer, or have the 'manage GitHub Pages settings' permission. A token with the repo scope or Pages write permission is required. GitHub Apps must have the administration:write and pages:write permissions.
"Create a GitHub AE Pages site" のパラメーター
| 名前, Type, 説明 |
|---|
accept string Setting to |
| 名前, Type, 説明 |
|---|
owner string 必須The account owner of the repository. The name is not case sensitive. |
repo string 必須The name of the repository without the |
| 名前, Type, 説明 | |||
|---|---|---|---|
build_type string The process in which the Page will be built. Possible values are 次のいずれかにできます: | |||
source object The source branch and directory used to publish your Pages site. | |||
Properties of |
| 名前, Type, 説明 |
|---|
branch string 必須The repository branch used to publish your site's source files. |
path string The repository directory that includes the source files for the Pages site. Allowed paths are Default: 次のいずれかにできます: |
"Create a GitHub AE Pages site" の HTTP 応答状態コード
| 状態コード | 説明 |
|---|---|
201 | Created |
409 | Conflict |
422 | Validation failed, or the endpoint has been spammed. |
"Create a GitHub AE Pages site" のコード サンプル
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
https://HOSTNAME/api/v3/repos/OWNER/REPO/pages \
-d '{"source":{"branch":"main","path":"/docs"}}'Response
Status: 201{
"url": "https://api.github.com/repos/github/developer.github.com/pages",
"status": "built",
"cname": "developer.github.com",
"custom_404": false,
"html_url": "https://developer.github.com",
"source": {
"branch": "master",
"path": "/"
},
"public": true,
"https_certificate": {
"state": "approved",
"description": "Certificate is approved",
"domains": [
"developer.github.com"
],
"expires_at": "2021-05-22"
},
"https_enforced": true
}Update information about a GitHub AE Pages site
Updates information for a GitHub AE Pages site. For more information, see "About GitHub Pages.
To use this endpoint, you must be a repository administrator, maintainer, or have the 'manage GitHub Pages settings' permission. A token with the repo scope or Pages write permission is required. GitHub Apps must have the administration:write and pages:write permissions.
"Update information about a GitHub AE Pages site" のパラメーター
| 名前, Type, 説明 |
|---|
accept string Setting to |
| 名前, Type, 説明 |
|---|
owner string 必須The account owner of the repository. The name is not case sensitive. |
repo string 必須The name of the repository without the |
| 名前, Type, 説明 | |||
|---|---|---|---|
cname string or null Specify a custom domain for the repository. Sending a | |||
https_enforced boolean Specify whether HTTPS should be enforced for the repository. | |||
build_type string The process by which the GitHub Pages site will be built. 次のいずれかにできます: | |||
source object Update the source for the repository. Must include the branch name and path. | |||
Properties of |
| 名前, Type, 説明 |
|---|
branch string 必須The repository branch used to publish your site's source files. |
path string 必須The repository directory that includes the source files for the Pages site. Allowed paths are 次のいずれかにできます: |
"Update information about a GitHub AE Pages site" の HTTP 応答状態コード
| 状態コード | 説明 |
|---|---|
204 | No Content |
400 | Bad Request |
409 | Conflict |
422 | Validation failed, or the endpoint has been spammed. |
"Update information about a GitHub AE Pages site" のコード サンプル
curl -L \
-X PUT \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
https://HOSTNAME/api/v3/repos/OWNER/REPO/pages \
-d '{"cname":"octocatblog.com","source":{"branch":"main","path":"/"}}'Response
Status: 204Delete a GitHub AE Pages site
Deletes a GitHub AE Pages site. For more information, see "About GitHub Pages.
To use this endpoint, you must be a repository administrator, maintainer, or have the 'manage GitHub Pages settings' permission. A token with the repo scope or Pages write permission is required. GitHub Apps must have the administration:write and pages:write permissions.
"Delete a GitHub AE Pages site" のパラメーター
| 名前, Type, 説明 |
|---|
accept string Setting to |
| 名前, Type, 説明 |
|---|
owner string 必須The account owner of the repository. The name is not case sensitive. |
repo string 必須The name of the repository without the |
"Delete a GitHub AE Pages site" の HTTP 応答状態コード
| 状態コード | 説明 |
|---|---|
204 | No Content |
404 | Resource not found |
409 | Conflict |
422 | Validation failed, or the endpoint has been spammed. |
"Delete a GitHub AE Pages site" のコード サンプル
curl -L \
-X DELETE \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
https://HOSTNAME/api/v3/repos/OWNER/REPO/pagesResponse
Status: 204List GitHub AE Pages builds
Lists builts of a GitHub AE Pages site.
A token with the repo scope is required. GitHub Apps must have the pages:read permission.
"List GitHub AE Pages builds" のパラメーター
| 名前, Type, 説明 |
|---|
accept string Setting to |
| 名前, Type, 説明 |
|---|
owner string 必須The account owner of the repository. The name is not case sensitive. |
repo string 必須The name of the repository without the |
| 名前, Type, 説明 |
|---|
per_page integer The number of results per page (max 100). Default: |
page integer Page number of the results to fetch. Default: |
"List GitHub AE Pages builds" の HTTP 応答状態コード
| 状態コード | 説明 |
|---|---|
200 | OK |
"List GitHub AE Pages builds" のコード サンプル
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
https://HOSTNAME/api/v3/repos/OWNER/REPO/pages/buildsResponse
Status: 200[
{
"url": "https://api.github.com/repos/github/developer.github.com/pages/builds/5472601",
"status": "built",
"error": {
"message": null
},
"pusher": {
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"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
},
"commit": "351391cdcb88ffae71ec3028c91f375a8036a26b",
"duration": 2104,
"created_at": "2014-02-10T19:00:49Z",
"updated_at": "2014-02-10T19:00:51Z"
}
]Request a GitHub AE Pages build
You can request that your site be built from the latest revision on the default branch. This has the same effect as pushing a commit to your default branch, but does not require an additional commit. Manually triggering page builds can be helpful when diagnosing build warnings and failures.
Build requests are limited to one concurrent build per repository and one concurrent build per requester. If you request a build while another is still in progress, the second request will be queued until the first completes.
"Request a GitHub AE Pages build" のパラメーター
| 名前, Type, 説明 |
|---|
accept string Setting to |
| 名前, Type, 説明 |
|---|
owner string 必須The account owner of the repository. The name is not case sensitive. |
repo string 必須The name of the repository without the |
"Request a GitHub AE Pages build" の HTTP 応答状態コード
| 状態コード | 説明 |
|---|---|
201 | Created |
"Request a GitHub AE Pages build" のコード サンプル
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
https://HOSTNAME/api/v3/repos/OWNER/REPO/pages/buildsResponse
Get latest Pages build
Gets information about the single most recent build of a GitHub AE Pages site.
A token with the repo scope is required. GitHub Apps must have the pages:read permission.
"Get latest Pages build" のパラメーター
| 名前, Type, 説明 |
|---|
accept string Setting to |
| 名前, Type, 説明 |
|---|
owner string 必須The account owner of the repository. The name is not case sensitive. |
repo string 必須The name of the repository without the |
"Get latest Pages build" の HTTP 応答状態コード
| 状態コード | 説明 |
|---|---|
200 | OK |
"Get latest Pages build" のコード サンプル
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
https://HOSTNAME/api/v3/repos/OWNER/REPO/pages/builds/latestResponse
Status: 200{
"url": "https://api.github.com/repos/github/developer.github.com/pages/builds/5472601",
"status": "built",
"error": {
"message": null
},
"pusher": {
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"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
},
"commit": "351391cdcb88ffae71ec3028c91f375a8036a26b",
"duration": 2104,
"created_at": "2014-02-10T19:00:49Z",
"updated_at": "2014-02-10T19:00:51Z"
}Get GitHub AE Pages build
Gets information about a GitHub AE Pages build.
A token with the repo scope is required. GitHub Apps must have the pages:read permission.
"Get GitHub AE Pages build" のパラメーター
| 名前, Type, 説明 |
|---|
accept string Setting to |
| 名前, Type, 説明 |
|---|
owner string 必須The account owner of the repository. The name is not case sensitive. |
repo string 必須The name of the repository without the |
build_id integer 必須 |
"Get GitHub AE Pages build" の HTTP 応答状態コード
| 状態コード | 説明 |
|---|---|
200 | OK |
"Get GitHub AE Pages build" のコード サンプル
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
https://HOSTNAME/api/v3/repos/OWNER/REPO/pages/builds/BUILD_IDResponse
Status: 200{
"url": "https://api.github.com/repos/github/developer.github.com/pages/builds/5472601",
"status": "built",
"error": {
"message": null
},
"pusher": {
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"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
},
"commit": "351391cdcb88ffae71ec3028c91f375a8036a26b",
"duration": 2104,
"created_at": "2014-02-10T19:00:49Z",
"updated_at": "2014-02-10T19:00:51Z"
}