Esta versión de GitHub Enterprise se discontinuó el 2023-03-15. No se realizarán lanzamientos de patch, ni siquiera para problemas de seguridad críticos. Para obtener rendimiento mejorado, seguridad mejorada y nuevas características, actualice a la versión más reciente de GitHub Enterprise. Para obtener ayuda con la actualización, póngase en contacto con el soporte técnico de GitHub Enterprise.
Recientemente hemos movido parte de la documentación de la API REST. Si no encuentras lo que estás buscando, puedes probar las nuevas páginas de la API REST Branches, Collaborators, Commits, Deploy Keys, Deployments, GitHub Pages, Releases, Metrics, Webhooks.
Páginas
Usa la API de REST para interactuar con los sitios y compilaciones de GitHub Pages.
Get a GitHub Enterprise Server Pages site
Gets information about a GitHub Enterprise Server Pages site.
A token with the repo
scope is required. GitHub Apps must have the pages:read
permission.
Parámetros para "Get a GitHub Enterprise Server Pages site"
Encabezados |
---|
Nombre, Tipo, Descripción |
accept string Setting to |
Parámetros de la ruta de acceso |
Nombre, Tipo, Descripción |
owner string RequeridoThe account owner of the repository. The name is not case sensitive. |
repo string RequeridoThe name of the repository. The name is not case sensitive. |
Códigos de estado de respuesta HTTP para "Get a GitHub Enterprise Server Pages site"
status code | Descripción |
---|---|
200 | OK |
404 | Resource not found |
Ejemplos de código para "Get a GitHub Enterprise Server Pages site"
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/pages
Response
Status: 200
{
"url": "https://HOSTNAME/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 Enterprise Server Pages site
Configures a GitHub Enterprise Server 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.
Parámetros para "Create a GitHub Enterprise Server Pages site"
Encabezados | ||||||
---|---|---|---|---|---|---|
Nombre, Tipo, Descripción | ||||||
accept string Setting to | ||||||
Parámetros de la ruta de acceso | ||||||
Nombre, Tipo, Descripción | ||||||
owner string RequeridoThe account owner of the repository. The name is not case sensitive. | ||||||
repo string RequeridoThe name of the repository. The name is not case sensitive. | ||||||
Parámetros del cuerpo | ||||||
Nombre, Tipo, Descripción | ||||||
build_type string The process in which the Page will be built. Possible values are Puede ser uno de los siguientes: | ||||||
source object The source branch and directory used to publish your Pages site. | ||||||
Properties of |
Nombre, Tipo, Descripción |
---|
branch string RequeridoThe 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 Valor predeterminado: Puede ser uno de los siguientes: |
Códigos de estado de respuesta HTTP para "Create a GitHub Enterprise Server Pages site"
status code | Descripción |
---|---|
201 | Created |
409 | Conflict |
422 | Validation failed, or the endpoint has been spammed. |
Ejemplos de código para "Create a GitHub Enterprise Server Pages site"
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/pages \
-d '{"source":{"branch":"main","path":"/docs"}}'
Response
Status: 201
{
"url": "https://HOSTNAME/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 Enterprise Server Pages site
Updates information for a GitHub Enterprise Server 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.
Parámetros para "Update information about a GitHub Enterprise Server Pages site"
Encabezados | ||||||
---|---|---|---|---|---|---|
Nombre, Tipo, Descripción | ||||||
accept string Setting to | ||||||
Parámetros de la ruta de acceso | ||||||
Nombre, Tipo, Descripción | ||||||
owner string RequeridoThe account owner of the repository. The name is not case sensitive. | ||||||
repo string RequeridoThe name of the repository. The name is not case sensitive. | ||||||
Parámetros del cuerpo | ||||||
Nombre, Tipo, Descripción | ||||||
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. Puede ser uno de los siguientes: | ||||||
source object Update the source for the repository. Must include the branch name and path. | ||||||
Properties of |
Nombre, Tipo, Descripción |
---|
branch string RequeridoThe repository branch used to publish your site's source files. |
path string RequeridoThe repository directory that includes the source files for the Pages site. Allowed paths are Puede ser uno de los siguientes: |
Códigos de estado de respuesta HTTP para "Update information about a GitHub Enterprise Server Pages site"
status code | Descripción |
---|---|
204 | No Content |
400 | Bad Request |
409 | Conflict |
422 | Validation failed, or the endpoint has been spammed. |
Ejemplos de código para "Update information about a GitHub Enterprise Server Pages site"
curl -L \
-X PUT \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/pages \
-d '{"cname":"octocatblog.com","source":{"branch":"main","path":"/"}}'
Response
Status: 204
Delete a GitHub Enterprise Server Pages site
Deletes a GitHub Enterprise Server 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.
Parámetros para "Delete a GitHub Enterprise Server Pages site"
Encabezados |
---|
Nombre, Tipo, Descripción |
accept string Setting to |
Parámetros de la ruta de acceso |
Nombre, Tipo, Descripción |
owner string RequeridoThe account owner of the repository. The name is not case sensitive. |
repo string RequeridoThe name of the repository. The name is not case sensitive. |
Códigos de estado de respuesta HTTP para "Delete a GitHub Enterprise Server Pages site"
status code | Descripción |
---|---|
204 | No Content |
404 | Resource not found |
409 | Conflict |
422 | Validation failed, or the endpoint has been spammed. |
Ejemplos de código para "Delete a GitHub Enterprise Server Pages site"
curl -L \
-X DELETE \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/pages
Response
Status: 204
List GitHub Enterprise Server Pages builds
Lists builts of a GitHub Enterprise Server Pages site.
A token with the repo
scope is required. GitHub Apps must have the pages:read
permission.
Parámetros para "List GitHub Enterprise Server Pages builds"
Encabezados |
---|
Nombre, Tipo, Descripción |
accept string Setting to |
Parámetros de la ruta de acceso |
Nombre, Tipo, Descripción |
owner string RequeridoThe account owner of the repository. The name is not case sensitive. |
repo string RequeridoThe name of the repository. The name is not case sensitive. |
Parámetros de consulta |
Nombre, Tipo, Descripción |
per_page integer The number of results per page (max 100). Valor predeterminado: |
page integer Page number of the results to fetch. Valor predeterminado: |
Códigos de estado de respuesta HTTP para "List GitHub Enterprise Server Pages builds"
status code | Descripción |
---|---|
200 | OK |
Ejemplos de código para "List GitHub Enterprise Server Pages builds"
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/pages/builds
Response
Status: 200
[
{
"url": "https://HOSTNAME/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://HOSTNAME/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://HOSTNAME/users/octocat/followers",
"following_url": "https://HOSTNAME/users/octocat/following{/other_user}",
"gists_url": "https://HOSTNAME/users/octocat/gists{/gist_id}",
"starred_url": "https://HOSTNAME/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://HOSTNAME/users/octocat/subscriptions",
"organizations_url": "https://HOSTNAME/users/octocat/orgs",
"repos_url": "https://HOSTNAME/users/octocat/repos",
"events_url": "https://HOSTNAME/users/octocat/events{/privacy}",
"received_events_url": "https://HOSTNAME/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 Enterprise Server 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.
Parámetros para "Request a GitHub Enterprise Server Pages build"
Encabezados |
---|
Nombre, Tipo, Descripción |
accept string Setting to |
Parámetros de la ruta de acceso |
Nombre, Tipo, Descripción |
owner string RequeridoThe account owner of the repository. The name is not case sensitive. |
repo string RequeridoThe name of the repository. The name is not case sensitive. |
Códigos de estado de respuesta HTTP para "Request a GitHub Enterprise Server Pages build"
status code | Descripción |
---|---|
201 | Created |
Ejemplos de código para "Request a GitHub Enterprise Server Pages build"
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/pages/builds
Response
Status: 201
{
"url": "https://HOSTNAME/repos/github/developer.github.com/pages/builds/latest",
"status": "queued"
}
Get latest Pages build
Gets information about the single most recent build of a GitHub Enterprise Server Pages site.
A token with the repo
scope is required. GitHub Apps must have the pages:read
permission.
Parámetros para "Get latest Pages build"
Encabezados |
---|
Nombre, Tipo, Descripción |
accept string Setting to |
Parámetros de la ruta de acceso |
Nombre, Tipo, Descripción |
owner string RequeridoThe account owner of the repository. The name is not case sensitive. |
repo string RequeridoThe name of the repository. The name is not case sensitive. |
Códigos de estado de respuesta HTTP para "Get latest Pages build"
status code | Descripción |
---|---|
200 | OK |
Ejemplos de código para "Get latest Pages build"
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/pages/builds/latest
Response
Status: 200
{
"url": "https://HOSTNAME/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://HOSTNAME/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://HOSTNAME/users/octocat/followers",
"following_url": "https://HOSTNAME/users/octocat/following{/other_user}",
"gists_url": "https://HOSTNAME/users/octocat/gists{/gist_id}",
"starred_url": "https://HOSTNAME/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://HOSTNAME/users/octocat/subscriptions",
"organizations_url": "https://HOSTNAME/users/octocat/orgs",
"repos_url": "https://HOSTNAME/users/octocat/repos",
"events_url": "https://HOSTNAME/users/octocat/events{/privacy}",
"received_events_url": "https://HOSTNAME/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 Enterprise Server Pages build
Gets information about a GitHub Enterprise Server Pages build.
A token with the repo
scope is required. GitHub Apps must have the pages:read
permission.
Parámetros para "Get GitHub Enterprise Server Pages build"
Encabezados |
---|
Nombre, Tipo, Descripción |
accept string Setting to |
Parámetros de la ruta de acceso |
Nombre, Tipo, Descripción |
owner string RequeridoThe account owner of the repository. The name is not case sensitive. |
repo string RequeridoThe name of the repository. The name is not case sensitive. |
build_id integer Requerido |
Códigos de estado de respuesta HTTP para "Get GitHub Enterprise Server Pages build"
status code | Descripción |
---|---|
200 | OK |
Ejemplos de código para "Get GitHub Enterprise Server Pages build"
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/pages/builds/BUILD_ID
Response
Status: 200
{
"url": "https://HOSTNAME/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://HOSTNAME/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://HOSTNAME/users/octocat/followers",
"following_url": "https://HOSTNAME/users/octocat/following{/other_user}",
"gists_url": "https://HOSTNAME/users/octocat/gists{/gist_id}",
"starred_url": "https://HOSTNAME/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://HOSTNAME/users/octocat/subscriptions",
"organizations_url": "https://HOSTNAME/users/octocat/orgs",
"repos_url": "https://HOSTNAME/users/octocat/repos",
"events_url": "https://HOSTNAME/users/octocat/events{/privacy}",
"received_events_url": "https://HOSTNAME/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"
}