Esta versión de GitHub Enterprise se discontinuó el 2022-06-03. No se realizarán lanzamientos de patch, ni siquiera para problemas de seguridad críticos. Para obtener un mejor desempeño, más seguridad y nuevas características, actualiza a la última versión de GitHub Enterprise. Para obtener ayuda con la actualización, contacta al soporte de GitHub Enterprise.
We've recently moved some of the REST API documentation. If you can't find what you're looking for, you might try the new Branches, Collaborators, Commits, Deploy Keys, Deployments, GitHub Pages, Releases, Metrics, Webhooks REST API pages.
Pages
La API de GitHub Pages te permite interactuar con la información de compilación y los sitios de GitHub Pages.
Get a GitHub Enterprise Server Pages site
Parámetros
Encabezados |
---|
Nombre, Tipo, Descripción |
accept stringSetting to |
Parámetros de ruta |
Nombre, Tipo, Descripción |
owner stringRequeridoThe account owner of the repository. The name is not case sensitive. |
repo stringRequeridoThe name of the repository. The name is not case sensitive. |
Códigos de estado de respuesta HTTP
Código de estado | Descripción |
---|---|
200 | OK |
404 | Resource not found |
Ejemplos de código
curl \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token <TOKEN>" \
http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/pages
Response
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 Enterprise Server Pages site
Configures a GitHub Enterprise Server Pages site. For more information, see "About GitHub Pages."
Parámetros
Encabezados | ||||||
---|---|---|---|---|---|---|
Nombre, Tipo, Descripción | ||||||
accept stringSetting to | ||||||
Parámetros de ruta | ||||||
Nombre, Tipo, Descripción | ||||||
owner stringRequeridoThe account owner of the repository. The name is not case sensitive. | ||||||
repo stringRequeridoThe name of the repository. The name is not case sensitive. | ||||||
Parámetros de cuerpo | ||||||
Nombre, Tipo, Descripción | ||||||
source objectThe source branch and directory used to publish your Pages site. | ||||||
Properties of the |
Nombre, Tipo, Descripción |
---|
branch stringRequeridoThe repository branch used to publish your site's source files. |
path stringThe repository directory that includes the source files for the Pages site. Allowed paths are Predeterminado: Puede ser una de las siguientes: |
Códigos de estado de respuesta HTTP
Código de estado | Descripción |
---|---|
201 | Created |
409 | Conflict |
422 | Validation failed |
Ejemplos de código
curl \
-X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token <TOKEN>" \
http(s)://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
}
Aviso de previsualización
Enabling and disabling Pages in the Pages API is currently available for developers to preview. See the blog post preview for more details. To access the new endpoints during the preview period, you must provide a custom media type in the Accept
header:
application/vnd.github.switcheroo-preview+json
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.
Parámetros
Encabezados |
---|
Nombre, Tipo, Descripción |
accept stringSetting to |
Parámetros de ruta |
Nombre, Tipo, Descripción |
owner stringRequeridoThe account owner of the repository. The name is not case sensitive. |
repo stringRequeridoThe name of the repository. The name is not case sensitive. |
Parámetros de cuerpo |
Nombre, Tipo, Descripción |
cname string or nullSpecify a custom domain for the repository. Sending a |
https_enforced booleanSpecify whether HTTPS should be enforced for the repository. |
public booleanConfigures access controls for the GitHub Pages site. If public is set to |
source |
Códigos de estado de respuesta HTTP
Código de estado | Descripción |
---|---|
204 | No Content |
400 | Bad Request |
422 | Validation failed |
Ejemplos de código
curl \
-X PUT \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token <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
Parámetros
Encabezados |
---|
Nombre, Tipo, Descripción |
accept stringSetting to |
Parámetros de ruta |
Nombre, Tipo, Descripción |
owner stringRequeridoThe account owner of the repository. The name is not case sensitive. |
repo stringRequeridoThe name of the repository. The name is not case sensitive. |
Códigos de estado de respuesta HTTP
Código de estado | Descripción |
---|---|
204 | No Content |
404 | Resource not found |
422 | Validation failed |
Ejemplos de código
curl \
-X DELETE \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token <TOKEN>" \
http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/pages
Response
Status: 204
Aviso de previsualización
Enabling and disabling Pages in the Pages API is currently available for developers to preview. See the blog post preview for more details. To access the new endpoints during the preview period, you must provide a custom media type in the Accept
header:
application/vnd.github.switcheroo-preview+json
List GitHub Enterprise Server Pages builds
Parámetros
Encabezados |
---|
Nombre, Tipo, Descripción |
accept stringSetting to |
Parámetros de ruta |
Nombre, Tipo, Descripción |
owner stringRequeridoThe account owner of the repository. The name is not case sensitive. |
repo stringRequeridoThe name of the repository. The name is not case sensitive. |
Parámetros de consulta |
Nombre, Tipo, Descripción |
per_page integerThe number of results per page (max 100). Predeterminado: |
page integerPage number of the results to fetch. Predeterminado: |
Códigos de estado de respuesta HTTP
Código de estado | Descripción |
---|---|
200 | OK |
Ejemplos de código
curl \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token <TOKEN>" \
http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/pages/builds
Response
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 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
Encabezados |
---|
Nombre, Tipo, Descripción |
accept stringSetting to |
Parámetros de ruta |
Nombre, Tipo, Descripción |
owner stringRequeridoThe account owner of the repository. The name is not case sensitive. |
repo stringRequeridoThe name of the repository. The name is not case sensitive. |
Códigos de estado de respuesta HTTP
Código de estado | Descripción |
---|---|
201 | Created |
Ejemplos de código
curl \
-X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token <TOKEN>" \
http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/pages/builds
Response
Status: 201
{
"url": "https://api.github.com/repos/github/developer.github.com/pages/builds/latest",
"status": "queued"
}
Get latest Pages build
Parámetros
Encabezados |
---|
Nombre, Tipo, Descripción |
accept stringSetting to |
Parámetros de ruta |
Nombre, Tipo, Descripción |
owner stringRequeridoThe account owner of the repository. The name is not case sensitive. |
repo stringRequeridoThe name of the repository. The name is not case sensitive. |
Códigos de estado de respuesta HTTP
Código de estado | Descripción |
---|---|
200 | OK |
Ejemplos de código
curl \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token <TOKEN>" \
http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/pages/builds/latest
Response
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 Enterprise Server Pages build
Parámetros
Encabezados |
---|
Nombre, Tipo, Descripción |
accept stringSetting to |
Parámetros de ruta |
Nombre, Tipo, Descripción |
owner stringRequeridoThe account owner of the repository. The name is not case sensitive. |
repo stringRequeridoThe name of the repository. The name is not case sensitive. |
build_id integerRequerido |
Códigos de estado de respuesta HTTP
Código de estado | Descripción |
---|---|
200 | OK |
Ejemplos de código
curl \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token <TOKEN>" \
http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/pages/builds/BUILD_ID
Response
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"
}