Skip to main content
Die REST-API verfügt jetzt über eine Versionskontrolle. Weitere Informationen findest du unter Informationen zur API-Versionsverwaltung.

REST-API-Endpunkte für benutzerdefinierte Eigenschaften

Verwenden Sie die REST-API, um die benutzerdefinierten Eigenschaften aufzulisten, die einem Repository der Organisation zugewiesen sind.

Informationen zu benutzerdefinierten Eigenschaften

Sie können die REST-API verwenden, um die benutzerdefinierten Eigenschaften anzuzeigen, die einem Repository von der Organisation zugewiesen wurden, die das Repository besitzt. Weitere Informationen findest du unter Verwalten von benutzerdefinierten Eigenschaften für Repositorys in Ihrer Organisation. Weitere Informationen zu den REST-API-Endpunkten zum Verwalten benutzerdefinierter Eigenschaften finden Sie unter „REST-API-Endpunkte für benutzerdefinierte Eigenschaften“.

Get all custom property values for a repository

Gets all custom property values that are set for a repository. Users with read access to the repository can use this endpoint.

Differenzierte Zugriffstoken für "Get all custom property values for a repository"

Dieser Endpunkt funktioniert mit den folgenden Tokentypen.:

Das Token muss einen der folgenden Berechtigungssätze aufweisen.:

  • metadata:read

Dieser Endpunkt kann ohne Authentifizierung oder die zuvor erwähnten Berechtigungen verwendet werden, wenn nur öffentliche Ressourcen angefordert werden.

Parameter für „Get all custom property values 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 without the .git extension. The name is not case sensitive.

HTTP-Antwortstatuscodes für „Get all custom property values for a repository“

StatuscodeBESCHREIBUNG
200

OK

403

Forbidden

404

Resource not found

Codebeispiele für „Get all custom property values for a repository“

Beispiel für eine Anfrage

get/repos/{owner}/{repo}/properties/values
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/OWNER/REPO/properties/values

Response

Status: 200
[ { "property_name": "environment", "value": "production" }, { "property_name": "service", "value": "web" }, { "property_name": "team", "value": "octocat" } ]

Create or update custom property values for a repository

Create new or update existing custom property values for a repository. Using a value of null for a custom property will remove or 'unset' the property value from the repository.

Repository admins and other users with the repository-level "edit custom property values" fine-grained permission can use this endpoint.

Differenzierte Zugriffstoken für "Create or update custom property values for a repository"

Dieser Endpunkt funktioniert mit den folgenden Tokentypen.:

Das Token muss einen der folgenden Berechtigungssätze aufweisen.:

  • repository_custom_properties:write

Parameter für „Create or update custom property values 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 without the .git extension. The name is not case sensitive.

Textparameter
Name, type, BESCHREIBUNG
properties array of objects Erforderlich

A list of custom property names and associated values to apply to the repositories.

Name, type, BESCHREIBUNG
property_name string Erforderlich

The name of the property

value null or string or array Erforderlich

The value assigned to the property

HTTP-Antwortstatuscodes für „Create or update custom property values for a repository“

StatuscodeBESCHREIBUNG
204

No Content when custom property values are successfully created or updated

403

Forbidden

404

Resource not found

422

Validation failed, or the endpoint has been spammed.

Codebeispiele für „Create or update custom property values for a repository“

Beispiel für eine Anfrage

patch/repos/{owner}/{repo}/properties/values
curl -L \ -X PATCH \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/OWNER/REPO/properties/values \ -d '{"properties":[{"property_name":"environment","value":"production"},{"property_name":"service","value":"web"},{"property_name":"team","value":"octocat"}]}'

No Content when custom property values are successfully created or updated

Status: 204