Custom properties API examples

1 minute read

When you need to manage application-specific custom properties via API, use the custom properties endpoints to list all properties, retrieve individual properties by name, or add new ones.

Example: Retrieve list of custom properties

Request
curl -L 'https://api.cloudbees.io/v2/applications/<applicationId>/custom-properties' \ --header 'Authorization: Bearer <personal_access_token>'
Response
{ "customProperties": [ { "id": "prop123", "name": "exampleProperty", "type": "String", "description": "Example description", "resourceId": "application456", "cascUrl": "https://casc.example.com/flag-config" } ] }

Example: Retrieve a custom property by name

Request
curl -L 'https://api.cloudbees.io/v2/applications/<applicationId>/custom-properties/by-name/<name>' \ --header 'Authorization: Bearer <personal_access_token>'
Response
{ "customProperty": { "id": "prop123", "name": "exampleProperty", "type": "String", "description": "Example description", "resourceId": "application456", "cascUrl": "https://casc.example.com/flag-config" } }

Example: Add a custom property

Request
curl -X POST 'https://api.cloudbees.io/v2/applications/<applicationId>/custom-properties' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer <personal_access_token>' \ --data '{ "name": "newProperty", "type": "Number", "description": "A numeric threshold", "isPermanent": true }'
Response
{ "customProperty": { "id": "prop456", "name": "newProperty", "type": "Number", "description": "A numeric threshold", "resourceId": "application456" } }