REST API endpoints for an organization's custom property values
Use the REST API to manage custom properties for an organization
Get all custom property values for an organization
Gets all custom property values that are set for an organization.
The organization must belong to an enterprise.
Access requirements:
- Organization admins
- OAuth tokens and personal access tokens (classic) with the
read:orgscope - Actors with the organization-level "read custom properties for an organization" fine-grained permission or above
Jetons d’accès affinés pour « Get all custom property values for an organization »
Ce point de terminaison fonctionne avec les types de jetons précis suivants:
- Jetons d’accès utilisateur d’application GitHub
- Jetons d’accès d’installation d’application GitHub
- Jetons d’accès personnel affiné
Le jeton précis doit avoir l’ensemble d’autorisations suivant:
- "Custom properties for organizations" organization permissions (read)
Paramètres pour « Get all custom property values for an organization »
| Nom, Type, Description |
|---|
accept string Setting to |
| Nom, Type, Description |
|---|
org string ObligatoireThe organization name. The name is not case sensitive. |
Codes d’état de la réponse HTTP pour « Get all custom property values for an organization »
| Code d’état | Description |
|---|---|
200 | OK |
403 | Forbidden |
404 | Resource not found |
Exemples de code pour « Get all custom property values for an organization »
Si vous accédez à GitHub à GHE.com, remplacez api.github.com par le sous-domaine dédié de votre entreprise à api.SUBDOMAIN.ghe.com.
Exemple de requête
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/organizations/ORG/org-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 an organization
Create new or update existing custom property values for an organization.
To remove a custom property value from an organization, set the property value to null.
The organization must belong to an enterprise.
Access requirements:
- Organization admins
- OAuth tokens and personal access tokens (classic) with the
admin:orgscope - Actors with the organization-level "edit custom properties for an organization" fine-grained permission
Jetons d’accès affinés pour « Create or update custom property values for an organization »
Ce point de terminaison fonctionne avec les types de jetons précis suivants:
- Jetons d’accès utilisateur d’application GitHub
- Jetons d’accès d’installation d’application GitHub
- Jetons d’accès personnel affiné
Le jeton précis doit avoir l’ensemble d’autorisations suivant:
- "Custom properties for organizations" organization permissions (write)
Paramètres pour « Create or update custom property values for an organization »
| Nom, Type, Description |
|---|
accept string Setting to |
| Nom, Type, Description |
|---|
org string ObligatoireThe organization name. The name is not case sensitive. |
| Nom, Type, Description | |||
|---|---|---|---|
properties array of objects ObligatoireA list of custom property names and associated values to apply to the organization. | |||
Properties of |
| Nom, Type, Description |
|---|
property_name string ObligatoireThe name of the property |
value null or string or array ObligatoireThe value assigned to the property |
Codes d’état de la réponse HTTP pour « Create or update custom property values for an organization »
| Code d’état | Description |
|---|---|
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. |
Exemples de code pour « Create or update custom property values for an organization »
Si vous accédez à GitHub à GHE.com, remplacez api.github.com par le sous-domaine dédié de votre entreprise à api.SUBDOMAIN.ghe.com.
Exemple de requête
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/organizations/ORG/org-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