Application API examples

1 minute read

When you need to discover or automate the management of your application-type services, use the Applications API to retrieve all services in your organization. It returns a list of services filtered by APPLICATION_FILTER, complete with metadata such as linked environments, component IDs, and repository URLs. This lets you integrate application discovery and environment binding into your CI/CD pipelines — so you can maintain consistent configuration and streamline deployments.

Example requests and responses are provided below to help you get started.

When you need to create an environment, refer to the Environment APIs, creating an ephemeral environment for a complete use case example.

Example: Retrieve applications and linked environments

Retrieve a list of applications associated with a specific organization and discover the environments each application is linked to.

Request
curl -L 'https://api.cloudbees.io/v1/organizations/<organization_id>/services?typeFilter=APPLICATION_FILTER' \ --header 'Authorization: Bearer <personal_access_token>'

Possible Responses

Response (when organization has no applications)
{ "service": [] }
Response (when organization has applications)
{ "service": [ { "id": "f7b22218-537b-4b0e-ae9c-c4097b08185a", "name": "cbp", "description": "", "endpointId": "", "repositoryUrl": "", "defaultBranch": "", "organizationId": "62c842de-a50d-48bb-9f86-19a43af9e7d8", "serviceType": "APPLICATION", "linkedComponentIds": [], "linkedEnvironmentIds": [ "13796f74-092f-453d-a215-a15904378f83", "d3458b5c-492f-4547-8b92-c45a8084cfdf", "63d4d821-5c1b-491b-b116-f04e6a94e209", "f0df6ca9-9cea-4d4d-b811-437666a1d01a" ] } ] }
While your organization may have multiple environments, only those specifically linked to the application are accessible for use with it. Ensure the necessary environments are linked to take full advantage of application functionality.

Example: Retrieve all flags in an application

To retrieve all flags in an application, refer to the Flag APIs for a complete example.

Example: Create a flag in an application

To create a flag in an application, refer to the Flag APIs for a complete example.