Skip to main content
Wir veröffentlichen regelmäßig Aktualisierungen unserer Dokumentation, und die Übersetzung dieser Seite ist möglicherweise noch nicht abgeschlossen. Aktuelle Informationen findest du in der englischsprachigen Dokumentation.
GitHub AE ist derzeit begrenzt freigegeben.

Bezeichnungen

Verwende die REST-API, um Bezeichnungen für Repositorys, Issues und Pull Requests zu verwalten.

Informationen zu Kennzeichnungen

Du kannst die REST-API verwenden, um Bezeichnungen für ein Repository zu verwalten und Bezeichnungen für Issues und Pull Requests hinzuzufügen oder zu entfernen. Jeder Pull Request ist ein Issue, aber nicht jedes Issue ist ein Pull Request. Aus diesem Grund werden „gemeinsame“ Aktionen für beide Features, z. B. das Verwalten von zugewiesenen Personen, Bezeichnungen und Meilensteinen, in den Endpunkten für Issues bereitgestellt.

List labels for an issue

Funktioniert mit GitHub Apps

Parameter für „List labels for an issue“

Header
Name, type, BESCHREIBUNG
accept string

Setting to application/vnd.github+json is recommended.

Pfadparameter
Name, type, BESCHREIBUNG
owner string Erforderlich

The account owner of the repository. The name is not case sensitive.

repo string Erforderlich

The name of the repository. The name is not case sensitive.

issue_number integer Erforderlich

The number that identifies the issue.

Abfrageparameter
Name, type, BESCHREIBUNG
per_page integer

The number of results per page (max 100).

Standard: 30

page integer

Page number of the results to fetch.

Standard: 1

HTTP-Antwortstatuscodes für „List labels for an issue“

StatuscodeBESCHREIBUNG
200

OK

301

Moved permanently

404

Resource not found

410

Gone

Codebeispiele für „List labels for an issue“

get/repos/{owner}/{repo}/issues/{issue_number}/labels
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ https://HOSTNAME/api/v3/repos/OWNER/REPO/issues/ISSUE_NUMBER/labels

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 } ]

Add labels to an issue

Funktioniert mit GitHub Apps

Parameter für „Add labels to an issue“

Header
Name, type, BESCHREIBUNG
accept string

Setting to application/vnd.github+json is recommended.

Pfadparameter
Name, type, BESCHREIBUNG
owner string Erforderlich

The account owner of the repository. The name is not case sensitive.

repo string Erforderlich

The name of the repository. The name is not case sensitive.

issue_number integer Erforderlich

The number that identifies the issue.

Textparameter
Name, type, BESCHREIBUNG
labels array of strings

The 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 string or an array of labels directly, but GitHub recommends passing an object with the labels key. You can also replace all of the labels for an issue. For more information, see "Set labels for an issue."

HTTP-Antwortstatuscodes für „Add labels to an issue“

StatuscodeBESCHREIBUNG
200

OK

301

Moved permanently

404

Resource not found

410

Gone

422

Validation failed, or the endpoint has been spammed.

Codebeispiele für „Add labels to an issue“

post/repos/{owner}/{repo}/issues/{issue_number}/labels
curl -L \ -X POST \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ https://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

Funktioniert mit GitHub Apps

Removes any previous labels and sets the new labels for an issue.

Parameter für „Set labels for an issue“

Header
Name, type, BESCHREIBUNG
accept string

Setting to application/vnd.github+json is recommended.

Pfadparameter
Name, type, BESCHREIBUNG
owner string Erforderlich

The account owner of the repository. The name is not case sensitive.

repo string Erforderlich

The name of the repository. The name is not case sensitive.

issue_number integer Erforderlich

The number that identifies the issue.

Textparameter
Name, type, BESCHREIBUNG
labels array of strings

The 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 string or an array of labels directly, but GitHub recommends passing an object with the labels key. You can also add labels to the existing labels for an issue. For more information, see "Add labels to an issue."

HTTP-Antwortstatuscodes für „Set labels for an issue“

StatuscodeBESCHREIBUNG
200

OK

301

Moved permanently

404

Resource not found

410

Gone

422

Validation failed, or the endpoint has been spammed.

Codebeispiele für „Set labels for an issue“

put/repos/{owner}/{repo}/issues/{issue_number}/labels
curl -L \ -X PUT \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ https://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

Funktioniert mit GitHub Apps

Parameter für „Remove all labels from an issue“

Header
Name, type, BESCHREIBUNG
accept string

Setting to application/vnd.github+json is recommended.

Pfadparameter
Name, type, BESCHREIBUNG
owner string Erforderlich

The account owner of the repository. The name is not case sensitive.

repo string Erforderlich

The name of the repository. The name is not case sensitive.

issue_number integer Erforderlich

The number that identifies the issue.

HTTP-Antwortstatuscodes für „Remove all labels from an issue“

StatuscodeBESCHREIBUNG
204

No Content

301

Moved permanently

404

Resource not found

410

Gone

Codebeispiele für „Remove all labels from an issue“

delete/repos/{owner}/{repo}/issues/{issue_number}/labels
curl -L \ -X DELETE \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ https://HOSTNAME/api/v3/repos/OWNER/REPO/issues/ISSUE_NUMBER/labels

Response

Status: 204

Remove a label from an issue

Funktioniert mit GitHub Apps

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.

Parameter für „Remove a label from an issue“

Header
Name, type, BESCHREIBUNG
accept string

Setting to application/vnd.github+json is recommended.

Pfadparameter
Name, type, BESCHREIBUNG
owner string Erforderlich

The account owner of the repository. The name is not case sensitive.

repo string Erforderlich

The name of the repository. The name is not case sensitive.

issue_number integer Erforderlich

The number that identifies the issue.

name string Erforderlich

HTTP-Antwortstatuscodes für „Remove a label from an issue“

StatuscodeBESCHREIBUNG
200

OK

301

Moved permanently

404

Resource not found

410

Gone

Codebeispiele für „Remove a label from an issue“

delete/repos/{owner}/{repo}/issues/{issue_number}/labels/{name}
curl -L \ -X DELETE \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ https://HOSTNAME/api/v3/repos/OWNER/REPO/issues/ISSUE_NUMBER/labels/NAME

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 } ]

List labels for a repository

Funktioniert mit GitHub Apps

Parameter für „List labels for a repository“

Header
Name, type, BESCHREIBUNG
accept string

Setting to application/vnd.github+json is recommended.

Pfadparameter
Name, type, BESCHREIBUNG
owner string Erforderlich

The account owner of the repository. The name is not case sensitive.

repo string Erforderlich

The name of the repository. The name is not case sensitive.

Abfrageparameter
Name, type, BESCHREIBUNG
per_page integer

The number of results per page (max 100).

Standard: 30

page integer

Page number of the results to fetch.

Standard: 1

HTTP-Antwortstatuscodes für „List labels for a repository“

StatuscodeBESCHREIBUNG
200

OK

404

Resource not found

Codebeispiele für „List labels for a repository“

get/repos/{owner}/{repo}/labels
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ https://HOSTNAME/api/v3/repos/OWNER/REPO/labels

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 } ]

Create a label

Funktioniert mit GitHub Apps

Parameter für „Create a label“

Header
Name, type, BESCHREIBUNG
accept string

Setting to application/vnd.github+json is recommended.

Pfadparameter
Name, type, BESCHREIBUNG
owner string Erforderlich

The account owner of the repository. The name is not case sensitive.

repo string Erforderlich

The name of the repository. The name is not case sensitive.

Textparameter
Name, type, BESCHREIBUNG
name string Erforderlich

The name of the label. Emoji can be added to label names, using either native emoji or colon-style markup. For example, typing :strawberry: will render the emoji :strawberry:. For a full list of available emoji and codes, see "Emoji cheat sheet."

color string

The hexadecimal color code for the label, without the leading #.

description string

A short description of the label. Must be 100 characters or fewer.

HTTP-Antwortstatuscodes für „Create a label“

StatuscodeBESCHREIBUNG
201

Created

404

Resource not found

422

Validation failed, or the endpoint has been spammed.

Codebeispiele für „Create a label“

post/repos/{owner}/{repo}/labels
curl -L \ -X POST \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ https://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

Funktioniert mit GitHub Apps

Parameter für „Get a label“

Header
Name, type, BESCHREIBUNG
accept string

Setting to application/vnd.github+json is recommended.

Pfadparameter
Name, type, BESCHREIBUNG
owner string Erforderlich

The account owner of the repository. The name is not case sensitive.

repo string Erforderlich

The name of the repository. The name is not case sensitive.

name string Erforderlich

HTTP-Antwortstatuscodes für „Get a label“

StatuscodeBESCHREIBUNG
200

OK

404

Resource not found

Codebeispiele für „Get a label“

get/repos/{owner}/{repo}/labels/{name}
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ https://HOSTNAME/api/v3/repos/OWNER/REPO/labels/NAME

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 }

Update a label

Funktioniert mit GitHub Apps

Parameter für „Update a label“

Header
Name, type, BESCHREIBUNG
accept string

Setting to application/vnd.github+json is recommended.

Pfadparameter
Name, type, BESCHREIBUNG
owner string Erforderlich

The account owner of the repository. The name is not case sensitive.

repo string Erforderlich

The name of the repository. The name is not case sensitive.

name string Erforderlich
Textparameter
Name, type, BESCHREIBUNG
new_name string

The new name of the label. Emoji can be added to label names, using either native emoji or colon-style markup. For example, typing :strawberry: will render the emoji :strawberry:. For a full list of available emoji and codes, see "Emoji cheat sheet."

color string

The hexadecimal color code for the label, without the leading #.

description string

A short description of the label. Must be 100 characters or fewer.

HTTP-Antwortstatuscodes für „Update a label“

StatuscodeBESCHREIBUNG
200

OK

Codebeispiele für „Update a label“

patch/repos/{owner}/{repo}/labels/{name}
curl -L \ -X PATCH \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ https://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

Funktioniert mit GitHub Apps

Parameter für „Delete a label“

Header
Name, type, BESCHREIBUNG
accept string

Setting to application/vnd.github+json is recommended.

Pfadparameter
Name, type, BESCHREIBUNG
owner string Erforderlich

The account owner of the repository. The name is not case sensitive.

repo string Erforderlich

The name of the repository. The name is not case sensitive.

name string Erforderlich

HTTP-Antwortstatuscodes für „Delete a label“

StatuscodeBESCHREIBUNG
204

No Content

Codebeispiele für „Delete a label“

delete/repos/{owner}/{repo}/labels/{name}
curl -L \ -X DELETE \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ https://HOSTNAME/api/v3/repos/OWNER/REPO/labels/NAME

Response

Status: 204

List labels for issues in a milestone

Funktioniert mit GitHub Apps

Parameter für „List labels for issues in a milestone“

Header
Name, type, BESCHREIBUNG
accept string

Setting to application/vnd.github+json is recommended.

Pfadparameter
Name, type, BESCHREIBUNG
owner string Erforderlich

The account owner of the repository. The name is not case sensitive.

repo string Erforderlich

The name of the repository. The name is not case sensitive.

milestone_number integer Erforderlich

The number that identifies the milestone.

Abfrageparameter
Name, type, BESCHREIBUNG
per_page integer

The number of results per page (max 100).

Standard: 30

page integer

Page number of the results to fetch.

Standard: 1

HTTP-Antwortstatuscodes für „List labels for issues in a milestone“

StatuscodeBESCHREIBUNG
200

OK

Codebeispiele für „List labels for issues in a milestone“

get/repos/{owner}/{repo}/milestones/{milestone_number}/labels
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ https://HOSTNAME/api/v3/repos/OWNER/REPO/milestones/MILESTONE_NUMBER/labels

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 } ]