Target Group API v2
Target Groups can be accessed and modified through this API using four services: GET, POST, PUT, and PATCH. These four services allow for the retrieval, creation, complete update, and partial update of Target Groups.
Terminology Change
The new v2 Target Group API replaces the Instance API from v1. The API has renamed Instance to Target Group, and Environment Instance to Target. The topology screens still refer to the old terminology, but will be updated in a future release as part of the new user experience.
Authentication - Use Basic Authentication for this API.
GET
There are two implementations of GET. One will find a Target Group with the given Id and return the JSON representation of the Target Group. The other will find a list of Target Groups matching the parameters supplied to it.
GET by ID
This GET service will find a Target Group with the given Id and return the JSON representation of the object.
API URL
http://host:port/flexdeploy/rest/v2/topology/targetgroup/{Id}
Request
Parameter | Required | Type | Description |
---|---|---|---|
Id | Yes | URL | URL parameter for the Id which is used to find and return a target group |
Response Codes
HTTP Code | Description |
---|---|
200 | Target Group was found and returned |
400 | Bad request |
401 | Authentication failure |
403 | Authorization failure (no access to resource) |
404 | Target Group not found |
500 | Unexpected internal server error |
Example
If we a Target Group in our database with an Id of 11004 and the following attributes
{ "description": "GET example description", "targets": [], "workflowPropertySets": [], "targetGroupId": 11004, "targetGroupName": "GET Example Name", "isActive": true, "pluginOperationPropertySets": [], "targetGroupCode": "GETEXAMPLECODE", "groupCode": "GET example group", "subGroupCode": "GET example sub group", "isDeploymentTarget": false }
When we run a GET request at the following URL
http://host:port/flexdeploy/rest/v2/topology/targetgroup/11004
The GET request would return the following JSON Target Group object
{ "description": "GET example description", "targets": [], "workflowPropertySets": [], "targetGroupId": 11004, "targetGroupName": "GET Example Name", "isActive": true, "pluginOperationPropertySets": [], "targetGroupCode": "GETEXAMPLECODE", "groupCode": "GET example group", "subGroupCode": "GET example sub group", "isDeploymentTarget": false }
GET by Query Parameters
This GET service will return a list of Target Groups in the form of JSON objects based on the query parameters targetGroupId, targetGroupCode, targetGroupName, groupCode, and subGroupCode. Target Groups are only returned if they match ALL of the specified query parameters. If no query parameters are given this request will return the entire list of Target Groups. The targetGroupName parameter returns Target Groups that contain the specified parameter. The other parameters must be equal to the Target Group.
API URL
http://host:port/flexdeploy/rest/v2/topology/targetgroup?
Append the following character sequences to the above URL to specify Query parameters.
Use '&' between successive query parameters:
targetGroupId = {targetGroupId}
targetGroupCode={targetGroupCode}
targetGroupName={targetGroupName}
groupCode={groupCode}
subGroupCode={subGroupCode}
Examples:
To Specify the code parameter only:
http://host:port/flexdeploy/rest/v2/topology/targetgroup?targetGroupCode={targetGroupCode}
To Specify the code and group code parameters:
http://host:port/flexdeploy/rest/v2/topology/targetgroup?targetGroupCode={targetGroupCode}&groupCode={groupCode}
To Specify the name, group code, and sub group code parameters:
http://host:port/flexdeploy/rest/v2/topology/targetgroup?targetGroupName={targetGroupName}&groupCode={groupCode}&subGroupCode={subGroupCode}
The query parameters are not case sensitive. Searching by targetGroupName=NAME is the same as searching by targetGroupName=name.
Request
Parameter | Required | Type | Description |
---|---|---|---|
targetGroupId | No | Query - Long | This is a URL query parameter for the Target Group Id which is used to search the Target Groups. |
targetGroupCode | No | Query - String | This is a URL query parameter for the Target Group code which is used to search the Target Groups. Equals ignore case search |
targetGroupName | No | Query - String | This is a URL query parameter for the Target Group name which is used to search the Target Groups. Contains ignore case search |
groupCode | No | Query - String | This is a URL query parameter for the group code which is used to search the Target Groups. Equals ignore case search |
subGroupCode | No | Query - String | This is a URL query parameter for the sub group code which is used to search the Target Groups. Equals ignore case search |
isActive | No | Query - Boolean | This is a URL query parameter for the isActive Boolean which is used to search the Target Groups. |
isDeploymentTarget | No | Query - Boolean | This is a URL query parameter for the isDeploymentTarget Boolean which is used to search the Target Groups. |
Response Codes
HTTP Code | Description |
---|---|
200 | Search successful and results returned |
400 | Bad request |
401 | Authentication failure |
403 | Authorization failure (no access to resource) |
500 | Unexpected internal server error |
Example
Output after sending a GET request while querying by Group Code "Group" through http://host:port/flexdeploy/rest/v2/topology/targetgroup?groupCode=Group
POST
The POST service will create a new Target Group with the same attributes as the given JSON object. It returns the JSON representation of the Target Group that was just created with an updated ID attribute.
API URL
http://host:port/flexdeploy/rest/v2/topology/targetgroup
Request
Attributes | Type | Required | Description |
---|---|---|---|
description | String | No | Description of the Target Group. |
targets | List<TargetDataObjects> | No | List of the Target Data Objects which are associated with this Target Group. |
workflowPropertySets | List<PropertySetDataObjects> | No | List of the Workflow Property Sets that are associated with this Target Group. |
targetGroupId | String | No | The unique id of the Target Group. The id is made when making the Target Group, and it is returned in the JSON. |
targetGroupName | String | Yes | Name of the Target Group. |
isActive | Boolean | No | Whether or not this Target Group is active. Defaults to true if nothing is passed. |
pluginOperationPropertySets | No | List of the Plugin Operation Property Sets that are associated with this Target Group. | |
targetGroupCode | String | Yes | The code of the Target Group. |
groupCode | String | No | The group code of the Target Group. |
subGroupCode | String | No | The sub group code of the Target Group. |
isDeploymentTarget | Boolean | No | Whether or not this Target Group is a deployment target. Defaults to true if nothing is passed. |
Response Codes
HTTP Code | Description |
---|---|
201 | Target Group was created successfully |
400 | Bad request |
401 | Authentication failure |
403 | Authorization failure (no access to resource) |
500 | Unexpected internal server error |
Example
If the POST receives the following JSON Target Group object,
the following Target Group will be created in the database. Notice the updated Target Group Id field.
PUT
This PUT service will update all attributes of a Target Group with the given Id based on the attributes of the supplied JSON object.
API URL
http://host:port/flexdeploy/rest/v2/topology/targetgroup/{Id}
Request
Attributes | Type | Required | Description |
---|---|---|---|
Id | URL | Yes | URL parameter for the Id which is used to find and update a Target Group. |
description | String | No | Description of the Target Group. |
targets | List<TargetDataObject> | No | List of the Targets that are associated with this Target Group. If currently associated Targets(s) are not in input list those Targets will be unassigned from this Target Group. i.e. at the end of successful request, the Target Group will have mapped Targets matching to input request. |
workflowPropertySets | List<PropertySetDataObject> | No | List of the Workflow Property Sets that are associated with this Target Group. If currently associated Property Set(s) are not in input list those Property Sets will be unassigned from this Target Group. i.e. at the end of successful request, the Target Group will have mapped Property Sets matching to input request. |
targetGroupId | String | No | The Target Group Id in the request is ignored. |
targetGroupName | String | Yes | Name of the Target Group. |
isActive | Boolean | No | Whether or not this Target Group is active. Defaults to true if nothing is passed. |
pluginOperationPropertySets | List<PropertySetDataObject> | No | List of the Plugin Operation Property Sets that are associated with this Target Group. If currently associated Property Set(s) are not in input list those Property Sets will be unassigned from this Target Group. i.e. at the end of successful request, the Target Group will have mapped Property Sets matching to input request. |
targetGroupCode | String | Yes | The code of the Target Group. |
groupCode | String | No | The group code of the Target Group. |
subGroupCode | String | No | The sub group code of the Target Group. |
isDeploymentTarget | Boolean | No | Whether or not this Target Group is a deployment target. Defaults to true if nothing is passed. |
Response Codes
HTTP Code | Description |
---|---|
200 | Target Group was found and updated |
400 | Bad request |
401 | Authentication failure |
403 | Authorization failure (no access to resource) |
404 | Target Group not found |
500 | Unexpected internal server error |
Example
If we had an Target Group in our database with an Id of 11104 and had the following attributes
When we run a PUT request at the following URL
http://host:port/flexdeploy/rest/v2/topology/targetgroup/11104
And the PUT request receives the following JSON Target Group object,
The PUT request would then update the Target Group with Id 11104 and return the following JSON Target Group object.
PATCH
This PATCH service will update the information of the Target Group of the specified Id with the non-null parameters of the JSON. The parameters that are null will not be changed in the Target Group.
API URL
http://host:port/flexdeploy/rest/v2/topology/targetgroup/{Id}
The only required attribute is the Target Group Id in the URL.
Request
Attributes | Type | Required | Description |
---|---|---|---|
Id | URL | Yes | URL parameter for the Id which is used to find and update an Target Group. |
description | String | No | Description of the Target Group. |
targets | List<TargetDataObject> | No | List of the Target Data Objects that will be added to the Target Group. If input targets(s) is not already associated, it will be associated to Target Group but existing Target assignment that are not in PATCH request will not be unassigned. i.e. input list is considered as append to existing assignments. |
workflowsPropertySets | List<PropertySetDataObject> | No | List of the Workflow Property Sets that will be added to the Target Group. If input Property Set(s) is not already associated, it will be associated to Target Group but existing Property Set assignment that are not in PATCH request will not be unassigned. i.e. input list is considered as append to existing assignments. |
targetGroupId | String | No | The Target Group Id in the request is ignored |
targetGroupName | String | No | Name of the Target Group. |
isActive | Boolean | No | Whether or not this Target Group is active. |
plugins | List<Plugin> | No | List of the Plugin Property Sets that will be added to the Target Group. If input Property Set(s) is not already associated, it will be associated to Target Group but existing Property Set assignment that are not in PATCH request will not be unassigned. i.e. input list is considered as append to existing assignments. |
targetGroupCode | String | No | The code of the Target Group. |
groupCode | String | No | The group code of the Target Group. |
subGroupCode | String | No | The sub group code of the Target Group. |
isDeploymentTarget | Boolean | No | Whether or not this Target Group is a deployment target. |
Response Codes
HTTP Code | Description |
---|---|
200 | Target Group was found and patched |
400 | Bad request |
401 | Authentication failure |
403 | Authorization failure (no access to resource) |
404 | Target Group not found |
500 | Unexpected internal server error |
Example
If we had a Target Group in our database with an Id of 11104 and had the following attributes
When we run a PATCH request at the following URL
http://host:port/flexdeploy/rest/v2/topology/targetgroup/11104
And the PATCH request receives the following JSON Target Group object,
The PATCH request would then update the Target Group with Id 11104 and return the following JSON Target Group object.
Only the fields present in the PATCH JSON will modify the original JSON Target Group object. All other fields will remain unchanged.
- style