Endpoints de API REST para propriedades definidas pelo usuário
Use a API REST para listar as propriedades personalizadas atribuídas a um repositório pela organização.
Sobre propriedades personalizadas
Você pode usar a API REST para visualizar as propriedades personalizadas que foram atribuídas a um repositório pela organização proprietária do repositório. Para saber mais, confira Como gerenciar propriedades personalizadas para repositórios na sua organização. Para obter mais informações sobre os pontos de extremidade da API REST para gerenciar propriedades personalizadas, confira Endpoints de API REST para propriedades definidas pelo usuário.
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.
fine_grained_access
works_with_fine_grained_tokens:
permission_set:
- "Metadata" repository permissions (read)
allows_public_read_access
Parâmetros para "Get all custom property values for a repository"
| Nome, Tipo, Descrição |
|---|
accept string Setting to |
| Nome, Tipo, Descrição |
|---|
owner string ObrigatórioThe account owner of the repository. The name is not case sensitive. |
repo string ObrigatórioThe name of the repository without the |
http_status_code
| status_code | Descrição |
|---|---|
200 | OK |
403 | Forbidden |
404 | Resource not found |
code_samples
request_example
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/properties/valuesResponse
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.
fine_grained_access
works_with_fine_grained_tokens:
permission_set:
- "Custom properties" repository permissions (write)
Parâmetros para "Create or update custom property values for a repository"
| Nome, Tipo, Descrição |
|---|
accept string Setting to |
| Nome, Tipo, Descrição |
|---|
owner string ObrigatórioThe account owner of the repository. The name is not case sensitive. |
repo string ObrigatórioThe name of the repository without the |
| Nome, Tipo, Descrição | |||
|---|---|---|---|
properties array of objects ObrigatórioA list of custom property names and associated values to apply to the repositories. | |||
Properties of |
| Nome, Tipo, Descrição |
|---|
property_name string ObrigatórioThe name of the property |
value null or string or array ObrigatórioThe value assigned to the property |
http_status_code
| status_code | Descrição |
|---|---|
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. |
code_samples
request_example
curl -L \
-X PATCH \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
http(s)://HOSTNAME/api/v3/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