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.
Vínculos automáticos del repositorio
Usa la API REST para agregar vínculos automáticos a recursos externos.
Acerca de los vínculos automáticos del repositorio
Para ayudar a optimizar tu flujo de trabajo, puedes utilizar la API REST para agregar vínculos automáticos a recursos externos como incidencias de JIRA y vales de Zendesk. Para más información, vea "Configuración de vínculos automáticos para hacer referencia a recursos externos".
Las GitHub Apps requieren permisos de administración de repositorios con acceso de lectura o escritura para utilizar estos puntos de conexión.
List all autolinks of a repository
This returns a list of autolinks configured for the given repository.
Information about autolinks are only available to repository administrators.
Parámetros
Encabezados |
---|
Nombre, Tipo, Descripción |
accept stringSetting to |
Parámetros de la ruta de acceso |
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 |
page integerPage number of the results to fetch. Valor predeterminado: |
Códigos de estado de respuesta HTTP
status code | Descripción |
---|---|
200 | OK |
Ejemplos de código
curl \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/autolinks
Response
Status: 200
[
{
"id": 1,
"key_prefix": "TICKET-",
"url_template": "https://example.com/TICKET?query=<num>"
}
]
Create an autolink reference for a repository
Users with admin access to the repository can create an autolink.
Parámetros
Encabezados |
---|
Nombre, Tipo, Descripción |
accept stringSetting to |
Parámetros de la ruta de acceso |
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 del cuerpo |
Nombre, Tipo, Descripción |
key_prefix stringRequeridoThe prefix appended by a number will generate a link any time it is found in an issue, pull request, or commit. |
url_template stringRequeridoThe URL must contain |
is_alphanumeric booleanWhether this autolink reference matches alphanumeric characters. If true, the Valor predeterminado: |
Códigos de estado de respuesta HTTP
status code | Descripción |
---|---|
201 | Created |
422 | Validation failed, or the endpoint has been spammed. |
Ejemplos de código
curl \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/autolinks \
-d '{"key_prefix":"TICKET-","url_template":"https://example.com/TICKET?query=<num>","is_alphanumeric":true}'
response
Status: 201
{
"id": 1,
"key_prefix": "TICKET-",
"url_template": "https://example.com/TICKET?query=<num>"
}
Get an autolink reference of a repository
This returns a single autolink reference by ID that was configured for the given repository.
Information about autolinks are only available to repository administrators.
Parámetros
Encabezados |
---|
Nombre, Tipo, Descripción |
accept stringSetting to |
Parámetros de la ruta de acceso |
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. |
autolink_id integerRequeridoThe unique identifier of the autolink. |
Códigos de estado de respuesta HTTP
status code | Descripción |
---|---|
200 | OK |
404 | Resource not found |
Ejemplos de código
curl \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/autolinks/AUTOLINK_ID
Response
Status: 200
{
"id": 1,
"key_prefix": "TICKET-",
"url_template": "https://example.com/TICKET?query=<num>"
}
Delete an autolink reference from a repository
This deletes a single autolink reference by ID that was configured for the given repository.
Information about autolinks are only available to repository administrators.
Parámetros
Encabezados |
---|
Nombre, Tipo, Descripción |
accept stringSetting to |
Parámetros de la ruta de acceso |
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. |
autolink_id integerRequeridoThe unique identifier of the autolink. |
Códigos de estado de respuesta HTTP
status code | Descripción |
---|---|
204 | No Content |
404 | Resource not found |
Ejemplos de código
curl \
-X DELETE \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/autolinks/AUTOLINK_ID
Response
Status: 204