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.
Etiquetas
About the Labels API
The Labels API supports managing labels for a repository and adding or removing labels to issues and pull requests. Cada solicitud de extracción es un informe de problemas, pero no todos los informes de problemas son una solicitud de extracción. For this reason, "shared" actions for both features, like managing assignees, labels, and milestones, are provided within Issues API.
List labels for an issue
Parámetros
| Encabezados | 
|---|
| Nombre, Tipo, Descripción | 
| acceptstringSetting to  | 
| Parámetros de ruta | 
| Nombre, Tipo, Descripción | 
| ownerstringRequeridoThe account owner of the repository. The name is not case sensitive. | 
| repostringRequeridoThe name of the repository. The name is not case sensitive. | 
| issue_numberintegerRequeridoThe number that identifies the issue. | 
| Parámetros de consulta | 
| Nombre, Tipo, Descripción | 
| per_pageintegerThe number of results per page (max 100). Predeterminado:  | 
| pageintegerPage number of the results to fetch. Predeterminado:  | 
Códigos de estado de respuesta HTTP
| Código de estado | Descripción | 
|---|---|
| 200 | OK | 
| 410 | Gone | 
Ejemplos de código
curl \
  -H "Accept: application/vnd.github.v3+json" \ 
  -H "Authorization: token <TOKEN>" \
  http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/issues/ISSUE_NUMBER/labelsResponse
Status: 200[
  {
    "id": 208045946,
    "node_id": "MDU6TGFiZWwyMDgwNDU5NDY=",
    "url": "https://api.github.com/repos/octocat/Hello-World/labels/bug",
    "name": "bug",
    "description": "Something isn't working",
    "color": "f29513",
    "default": true
  },
  {
    "id": 208045947,
    "node_id": "MDU6TGFiZWwyMDgwNDU5NDc=",
    "url": "https://api.github.com/repos/octocat/Hello-World/labels/enhancement",
    "name": "enhancement",
    "description": "New feature or request",
    "color": "a2eeef",
    "default": false
  }
]Add labels to an issue
Parámetros
| Encabezados | 
|---|
| Nombre, Tipo, Descripción | 
| acceptstringSetting to  | 
| Parámetros de ruta | 
| Nombre, Tipo, Descripción | 
| ownerstringRequeridoThe account owner of the repository. The name is not case sensitive. | 
| repostringRequeridoThe name of the repository. The name is not case sensitive. | 
| issue_numberintegerRequeridoThe number that identifies the issue. | 
| Parámetros de cuerpo | 
| Nombre, Tipo, Descripción | 
| labelsarray of stringsThe names of the labels to add to the issue's existing labels. You can pass an empty array to remove all labels. Alternatively, you can pass a single label as a  | 
Códigos de estado de respuesta HTTP
| Código de estado | Descripción | 
|---|---|
| 200 | OK | 
| 410 | Gone | 
| 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/issues/ISSUE_NUMBER/labels \
  -d '{"labels":["bug","enhancement"]}'Response
Status: 200[
  {
    "id": 208045946,
    "node_id": "MDU6TGFiZWwyMDgwNDU5NDY=",
    "url": "https://api.github.com/repos/octocat/Hello-World/labels/bug",
    "name": "bug",
    "description": "Something isn't working",
    "color": "f29513",
    "default": true
  },
  {
    "id": 208045947,
    "node_id": "MDU6TGFiZWwyMDgwNDU5NDc=",
    "url": "https://api.github.com/repos/octocat/Hello-World/labels/enhancement",
    "name": "enhancement",
    "description": "New feature or request",
    "color": "a2eeef",
    "default": false
  }
]Set labels for an issue
Removes any previous labels and sets the new labels for an issue.
Parámetros
| Encabezados | 
|---|
| Nombre, Tipo, Descripción | 
| acceptstringSetting to  | 
| Parámetros de ruta | 
| Nombre, Tipo, Descripción | 
| ownerstringRequeridoThe account owner of the repository. The name is not case sensitive. | 
| repostringRequeridoThe name of the repository. The name is not case sensitive. | 
| issue_numberintegerRequeridoThe number that identifies the issue. | 
| Parámetros de cuerpo | 
| Nombre, Tipo, Descripción | 
| labelsarray of stringsThe names of the labels to set for the issue. The labels you set replace any existing labels. You can pass an empty array to remove all labels. Alternatively, you can pass a single label as a  | 
Códigos de estado de respuesta HTTP
| Código de estado | Descripción | 
|---|---|
| 200 | OK | 
| 410 | Gone | 
| 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/issues/ISSUE_NUMBER/labels \
  -d '{"labels":["bug","enhancement"]}'Response
Status: 200[
  {
    "id": 208045946,
    "node_id": "MDU6TGFiZWwyMDgwNDU5NDY=",
    "url": "https://api.github.com/repos/octocat/Hello-World/labels/bug",
    "name": "bug",
    "description": "Something isn't working",
    "color": "f29513",
    "default": true
  },
  {
    "id": 208045947,
    "node_id": "MDU6TGFiZWwyMDgwNDU5NDc=",
    "url": "https://api.github.com/repos/octocat/Hello-World/labels/enhancement",
    "name": "enhancement",
    "description": "New feature or request",
    "color": "a2eeef",
    "default": false
  }
]Remove all labels from an issue
Parámetros
| Encabezados | 
|---|
| Nombre, Tipo, Descripción | 
| acceptstringSetting to  | 
| Parámetros de ruta | 
| Nombre, Tipo, Descripción | 
| ownerstringRequeridoThe account owner of the repository. The name is not case sensitive. | 
| repostringRequeridoThe name of the repository. The name is not case sensitive. | 
| issue_numberintegerRequeridoThe number that identifies the issue. | 
Códigos de estado de respuesta HTTP
| Código de estado | Descripción | 
|---|---|
| 204 | No Content | 
| 410 | Gone | 
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/issues/ISSUE_NUMBER/labelsResponse
Status: 204Remove a label from an issue
Removes the specified label from the issue, and returns the remaining labels on the issue. This endpoint returns a 404 Not Found status if the label does not exist.
Parámetros
| Encabezados | 
|---|
| Nombre, Tipo, Descripción | 
| acceptstringSetting to  | 
| Parámetros de ruta | 
| Nombre, Tipo, Descripción | 
| ownerstringRequeridoThe account owner of the repository. The name is not case sensitive. | 
| repostringRequeridoThe name of the repository. The name is not case sensitive. | 
| issue_numberintegerRequeridoThe number that identifies the issue. | 
| namestringRequerido | 
Códigos de estado de respuesta HTTP
| Código de estado | Descripción | 
|---|---|
| 200 | OK | 
| 404 | Resource not found | 
| 410 | Gone | 
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/issues/ISSUE_NUMBER/labels/NAMEResponse
Status: 200[
  {
    "id": 208045946,
    "node_id": "MDU6TGFiZWwyMDgwNDU5NDY=",
    "url": "https://api.github.com/repos/octocat/Hello-World/labels/bug",
    "name": "bug",
    "description": "Something isn't working",
    "color": "f29513",
    "default": true
  }
]List labels for a repository
Parámetros
| Encabezados | 
|---|
| Nombre, Tipo, Descripción | 
| acceptstringSetting to  | 
| Parámetros de ruta | 
| Nombre, Tipo, Descripción | 
| ownerstringRequeridoThe account owner of the repository. The name is not case sensitive. | 
| repostringRequeridoThe name of the repository. The name is not case sensitive. | 
| Parámetros de consulta | 
| Nombre, Tipo, Descripción | 
| per_pageintegerThe number of results per page (max 100). Predeterminado:  | 
| pageintegerPage number of the results to fetch. Predeterminado:  | 
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/labelsResponse
Status: 200[
  {
    "id": 208045946,
    "node_id": "MDU6TGFiZWwyMDgwNDU5NDY=",
    "url": "https://api.github.com/repos/octocat/Hello-World/labels/bug",
    "name": "bug",
    "description": "Something isn't working",
    "color": "f29513",
    "default": true
  },
  {
    "id": 208045947,
    "node_id": "MDU6TGFiZWwyMDgwNDU5NDc=",
    "url": "https://api.github.com/repos/octocat/Hello-World/labels/enhancement",
    "name": "enhancement",
    "description": "New feature or request",
    "color": "a2eeef",
    "default": false
  }
]Create a label
Parámetros
| Encabezados | 
|---|
| Nombre, Tipo, Descripción | 
| acceptstringSetting to  | 
| Parámetros de ruta | 
| Nombre, Tipo, Descripción | 
| ownerstringRequeridoThe account owner of the repository. The name is not case sensitive. | 
| repostringRequeridoThe name of the repository. The name is not case sensitive. | 
| Parámetros de cuerpo | 
| Nombre, Tipo, Descripción | 
| namestringRequeridoThe name of the label. Emoji can be added to label names, using either native emoji or colon-style markup. For example, typing  | 
| colorstringThe hexadecimal color code for the label, without the leading  | 
| descriptionstringA short description of the label. Must be 100 characters or fewer. | 
Códigos de estado de respuesta HTTP
| Código de estado | Descripción | 
|---|---|
| 201 | Created | 
| 404 | Resource not found | 
| 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/labels \
  -d '{"name":"bug","description":"Something isn't working","color":"f29513"}'Response
Status: 201{
  "id": 208045946,
  "node_id": "MDU6TGFiZWwyMDgwNDU5NDY=",
  "url": "https://api.github.com/repos/octocat/Hello-World/labels/bug",
  "name": "bug",
  "description": "Something isn't working",
  "color": "f29513",
  "default": true
}Get a label
Parámetros
| Encabezados | 
|---|
| Nombre, Tipo, Descripción | 
| acceptstringSetting to  | 
| Parámetros de ruta | 
| Nombre, Tipo, Descripción | 
| ownerstringRequeridoThe account owner of the repository. The name is not case sensitive. | 
| repostringRequeridoThe name of the repository. The name is not case sensitive. | 
| namestringRequerido | 
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/labels/NAMEResponse
Status: 200{
  "id": 208045946,
  "node_id": "MDU6TGFiZWwyMDgwNDU5NDY=",
  "url": "https://api.github.com/repos/octocat/Hello-World/labels/bug",
  "name": "bug",
  "description": "Something isn't working",
  "color": "f29513",
  "default": true
}Update a label
Parámetros
| Encabezados | 
|---|
| Nombre, Tipo, Descripción | 
| acceptstringSetting to  | 
| Parámetros de ruta | 
| Nombre, Tipo, Descripción | 
| ownerstringRequeridoThe account owner of the repository. The name is not case sensitive. | 
| repostringRequeridoThe name of the repository. The name is not case sensitive. | 
| namestringRequerido | 
| Parámetros de cuerpo | 
| Nombre, Tipo, Descripción | 
| new_namestringThe new name of the label. Emoji can be added to label names, using either native emoji or colon-style markup. For example, typing  | 
| colorstringThe hexadecimal color code for the label, without the leading  | 
| descriptionstringA short description of the label. Must be 100 characters or fewer. | 
Códigos de estado de respuesta HTTP
| Código de estado | Descripción | 
|---|---|
| 200 | OK | 
Ejemplos de código
curl \
  -X PATCH \
  -H "Accept: application/vnd.github.v3+json" \ 
  -H "Authorization: token <TOKEN>" \
  http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/labels/NAME \
  -d '{"new_name":"bug :bug:","description":"Small bug fix required","color":"b01f26"}'Response
Status: 200{
  "id": 208045946,
  "node_id": "MDU6TGFiZWwyMDgwNDU5NDY=",
  "url": "https://api.github.com/repos/octocat/Hello-World/labels/bug%20:bug:",
  "name": "bug :bug:",
  "description": "Small bug fix required",
  "color": "b01f26",
  "default": true
}Delete a label
Parámetros
| Encabezados | 
|---|
| Nombre, Tipo, Descripción | 
| acceptstringSetting to  | 
| Parámetros de ruta | 
| Nombre, Tipo, Descripción | 
| ownerstringRequeridoThe account owner of the repository. The name is not case sensitive. | 
| repostringRequeridoThe name of the repository. The name is not case sensitive. | 
| namestringRequerido | 
Códigos de estado de respuesta HTTP
| Código de estado | Descripción | 
|---|---|
| 204 | No Content | 
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/labels/NAMEResponse
Status: 204List labels for issues in a milestone
Parámetros
| Encabezados | 
|---|
| Nombre, Tipo, Descripción | 
| acceptstringSetting to  | 
| Parámetros de ruta | 
| Nombre, Tipo, Descripción | 
| ownerstringRequeridoThe account owner of the repository. The name is not case sensitive. | 
| repostringRequeridoThe name of the repository. The name is not case sensitive. | 
| milestone_numberintegerRequeridoThe number that identifies the milestone. | 
| Parámetros de consulta | 
| Nombre, Tipo, Descripción | 
| per_pageintegerThe number of results per page (max 100). Predeterminado:  | 
| pageintegerPage 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/milestones/MILESTONE_NUMBER/labelsResponse
Status: 200[
  {
    "id": 208045946,
    "node_id": "MDU6TGFiZWwyMDgwNDU5NDY=",
    "url": "https://api.github.com/repos/octocat/Hello-World/labels/bug",
    "name": "bug",
    "description": "Something isn't working",
    "color": "f29513",
    "default": true
  },
  {
    "id": 208045947,
    "node_id": "MDU6TGFiZWwyMDgwNDU5NDc=",
    "url": "https://api.github.com/repos/octocat/Hello-World/labels/enhancement",
    "name": "enhancement",
    "description": "New feature or request",
    "color": "a2eeef",
    "default": false
  }
] . For a full list of available emoji and codes, see "
. For a full list of available emoji and codes, see "