This page provides API reference details for managing target groups in CloudBees platform. Target groups allow you to define user segments based on attributes and conditions for use in feature flag targeting. This page includes endpoints for retrieving, creating, updating, and deleting target groups, along with request and response examples to help you implement advanced targeting rules within your applications.
Retrieve a target group
Use the target group ID to retrieve a single target group within an application.
The target group ID (the targetGroupId field) is a UUID that uniquely identifies the target group in the CloudBees platform.
|
GET /v2/applications/{applicationId}/target-groups/{targetGroupId}
Parameter name | In | Type | Required? | Description |
---|---|---|---|---|
|
Path |
String |
Yes |
The application ID. |
|
Path |
String |
Yes |
The target group ID. |
Responses
The following table outlines the possible responses from this endpoint, including status codes, their meanings, and schema.
Status Code | Description | Schema |
---|---|---|
200 |
Success. The request succeeded, and the response includes the details of the specified target group. |
|
Default |
Error. Occurs when the |
|
{ "targetGroup": { "id": "tg123", "name": "Beta Testers", "description": "Group for beta testing users", "conditions": { "attribute": "email", "operator": "endsWith", "value": "@example.com" }, "resourceId": "res-456", "cascUrl": "https://casc.example.com/config" } }
Retrieve a target group by name
Retrieve a specific target group using its name instead of its ID. This endpoint returns details about the target group, including its description, conditions, and associated resources.
GET /v2/applications/{applicationId}/target-groups/by-name/{name}
Parameter name | In | Type | Required? | Description |
---|---|---|---|---|
|
Path |
String |
Yes |
The application ID. |
|
Path |
String |
Yes |
The name of the target group. |
Responses
The following table outlines the possible responses for this endpoint, including status codes, their meanings, and schema.
Status Code | Description | Schema |
---|---|---|
200 |
Success. The request succeeded, and the response includes the details of the specified target group. |
|
Default |
Error. Occurs when the |
|
{ "targetGroup": { "id": "string", "name": "string", "description": "string", "conditions": {}, "resourceId": "string", "cascUrl": "string" } }
Update a target group
Update the details of an existing target group within an application.
PUT /v2/applications/{applicationId}/target-groups/{targetGroupId}
Parameter name | In | Type | Required? | Description |
---|---|---|---|---|
|
Path |
String |
Yes |
The application ID. |
|
Path |
String |
Yes |
The target group ID. |
{ "name": "beta testers", "conditions": { "property": { "name": "prop2", "operator": "is-true" } } }
Responses
The following table outlines the possible responses from this endpoint, including status codes, and their meanings.
Status Code | Description |
---|---|
200 |
Success. The request succeeded, and the response includes the updated target group details. |
Default |
Error. Occurs when the request is invalid, or the user lacks sufficient permissions. The error response includes an error code, message, and metadata. |
{ "targetGroup": { "id": "tg123", "name": "Updated Beta Testers", "description": "Updated group for beta testing users", "conditions": { "attribute": "email", "operator": "contains", "value": "testuser" }, "resourceId": "res-456", "cascUrl": "https://casc.example.com/new-config" } }
{ "code": 0, "message": "Invalid request", "details": [ { "@type": "string", "additionalProp1": {} } ] }
Delete a target group
Use the CloudBees API to delete a target group from an application.
DELETE /v2/applications/{applicationId}/target-groups/{targetGroupId}
Parameter | Type | Required? | Description |
---|---|---|---|
|
String |
Yes |
The application ID to which the target group belongs. |
|
String |
Yes |
The ID of the target group to delete. |
curl -X DELETE -L 'https://api.cloudbees.io/v2/applications/{applicationId}/target-groups/<targetGroupId>' \ --header 'Authorization: Bearer <personal_access_token>'
Responses
The following table outlines the possible responses for this endpoint, including status codes, their meanings, and the schemas that describe the structure of the returned data or errors.
Status Code | Description | Schema |
---|---|---|
200 |
Success. The request succeeded, and the target group has been deleted. The response does not include a body. |
No content |
Default |
Error. Occurs when the |
|
{ "code": 403, "message": "Permission denied. You do not have access to delete this target group.", "details": [ { "@type": "type.googleapis.com/google.rpc.Status", "additionalProp1": {} } ] }
This action permanently deletes the target group and cannot be undone.
Ensure that no feature flags or rules depend on this target group before deleting it.
The API may return a |