Get Asset Group Details by Asset Group ID

Use this API to retrieve the details of an asset group in the
Control Compliance Suite
12.5 asset system. Provide asset group GUID in input request to retrieve the asset group details.
Authentication
To grant access to users to view or execute
Control Compliance Suite
RESTful APIs, you must generate an authentication token.
Authorization requirements
You must have permissions to execute the following task to use the Get Asset Group Details by Asset Group ID API:
  • View Assets
You must have the permission to access the following folders to use the Get Asset Group Details by Asset Group ID API:
  • Asset System
  Request method
To retrieve the details of a
Control Compliance Suite
asset in your environment, create a
GET
request.
  HTTPS request components for Get Asset Group Details by Asset Group ID API
Create a GET request by using the following components:
HTTPS request components for Get Asset Group Details by Asset Group ID API
Request component
Value
URL
https://<hostname>:<port number>/ccs/api/v1/AssetGroup/{AssetGroupID}
You can also use the Fully Qualified Domain Name (FQDN) as the hostname. You can configure the port number from the
Integration Services Endpoint Configuration
dialog box from
Settings
>
Deployment View
on the
Control Compliance Suite
console. You must restart the Symantec Application Server Service after you configure the port. If you do not configure the port, the default port is considered in the request. The default port is 12431.
Content type
application/json
  HTTPS request parameters for Get Asset Group Details by Asset Group ID API
The following table contains the description of the HTTPS request parameter for the Get Asset Group Details by Asset Group ID API:
  HTTPS request parameters for Get Asset Group Details by Asset Group ID API
Field name
Field type
Data type
Description
AssetGroupID
Mandatory
GUID
This is the unique identifier of the asset group of which you want to retrieve the details.
  Response body for Get Asset Group Details by Asset Group ID API
The GET request for the Get Asset Group Details by Asset Group ID API returns the response body in the following structure:
Success Response: { "AssetGroupDetails": { "symc-csm-AssetSystem-AssetGroup-AssetTypes:[..], "DisplayName": {String} "symc-csm-AssetSystem-AssetGroup-Description": {String} "GroupID": {GUID} "symc-csm-AssetSystem-AssetGroup": {String} "symc-csm-AssetSystem-ModifiedBy": {String} "symc-csm-AssetSystem-AssetGroup-Owner": {String} "ContainerPath": {String} } }
Sample HTTPS request for Get Asset Group Details by Asset Group ID API
The following is a sample HTTPS request for your reference.
Sample HTTPS request
Request component
Value
URL
https://<hostname>:<port number>/ccs/api/v1/AssetGroup/018523a6-4771-41fb-90cb-df7ab3c23cda
Content type
application/json
  Sample HTTPS response for Get Asset Group Details by Asset Group ID API
The sample HTTPS request that you created earlier returns the following response:
{ "AssetGroupDetails": { "symc-csm-AssetSystem-AssetGroup-AssetTypes": [ "symc-csm-AssetSystem-Asset-Unix-Machine" ], "DisplayName": "Custom Static AssetGroup", "symc-csm-AssetSystem-AssetGroup-Description": null, "GroupID": "018523a6-4771-41fb-90cb-df7ab3c23cda", "symc-csm-AssetSystem-AssetGroup": "Static", "symc-csm-AssetSystem-ModifiedBy": "AUTOMATION\\administrator", "symc-csm-AssetSystem-AssetGroup-Owner": "AUTOMATION\\administrator", "ContainerPath": "Asset System" } }
HTTPS response codes for Get Asset Group Details by Asset Group ID API
Depending on the success or the failure of your API request, you see the following response codes for the Search Assets API:
HTTPS response codes for Get Asset Group Details by Asset Group ID API
Response Code
Response Type
Description
200
OK
The following asset group details are retrieved:
  • Asset types
  • Asset group name
  • Description
  • Asset group ID
  • Asset group type
  • Modified by
  • Owner
  • Container path
403
Forbidden
The following error message is displayed:
You are not authorized to perform this operation. Access is denied.
404
Not Found
If the user has the View Assets permissions but does not have rights to view the asset for which details are retrieved, or if the specified asset does not exist in the
Control Compliance Suite
asset system, the following error message is displayed:
The asset group details could not be obtained completely. This may be because you do not have sufficient permissions, or the asset group is already deleted from the Directory Server, or the asset group with the specified GUID does not exist.
401
Unauthorized
This may be because of an invalid or expired access token in an API request.
400
Bad Request
(Client Error)
The following error message is displayed:
Asset group ID is either null or invalid.
500
Internal Server Error
(Server Error)
The following error message is displayed:
Server encountered an error while serving request. Please contact administrator if problem persists.
Sample Python script for Get Asset Group Details by Asset Group ID API
import requests from requests.packages.urllib3.exceptions import InsecureRequestWarning def getToken(): urlToken = "https://<host name>:<port number>/ccs/api/v1/oauth/tokens" payload = "grant_type=password&username=<domain name>\\<user name>&password=<password>" headers = { 'Content-Type': "application/json", } responseToken = requests.request("POST", urlToken, data=payload, headers=headers, verify=False) tokenDict = responseToken.json() token = tokenDict['access_token'] refreshToken = tokenDict['refresh_token'] #print("bearer Token is:\n") #print(token) #print("\n Refresh Token is:\n") #print(refreshToken) return token url = "https://<host name>:<port number>/ccs/api/v1/AssetGroup/91537a11-da0a-4517-93c0-fa7a2e6c6e39" requests.packages.urllib3.disable_warnings(InsecureRequestWarning) bearertoken = "Bearer " + getToken() #print("\n Bearer Token is:\n") #print(bearertoken + "\n") headers = { 'Authorization': bearertoken, 'Content-Type': "application/json" } response = requests.request("GET", url, headers=headers, verify=False) print(response.text) print(response.json)
Sample Python script for Get Asset Group Details by Asset Group ID API
Click to view a sample Python script for Get Asset Group Details by Asset Group ID API
#Script to retrieve the details of an assetgroup by providing assetgroup GUID in the input request. import requests from requests.packages.urllib3.exceptions import InsecureRequestWarning # Declare Variables # Replace the <hostname> with CCS application server host name # Replace the <port number> with the configured port number for REST API, Default Port Number : 12431 # Replace the <user name> and <password> with valid CCS user name and password for example: UserName = domain1\\administrator, password = <Base64 encoded> HostName = '<hostname>' PortNumber = '<port number>' UserName = '<user name>' Password = '<password>' #<Base64 encoded> # Function to generate CCS REST API access token def getToken(): urlToken = "https://" + HostName + ":" + PortNumber + "/ccs/api/v1/oauth/tokens" payload = "grant_type=password&username=" + UserName + "&password=" + Password +"" headers = {'Content-Type': "application/json"} responseToken = requests.request("POST", urlToken, data=payload, headers=headers, verify=False) autheticationresult = responseToken.status_code if (autheticationresult!=200) : print("\nToken Generation Failed. Please check if the REST API is enabled and User name and password is correct\n") exit() tokenDict = responseToken.json() token = tokenDict['access_token'] refreshToken = tokenDict['refresh_token'] return token #Get AssetGroupDetails By AssetGroupID API endpoint URL. Provide the Assetgroup GUID in the request for getting the details for specific assetgroup. #You can use SerachAssetGroup API to get the GUID of the Asset group. url = "https://" + HostName + ":" + PortNumber + "/ccs/api/v1/AssetGroup/817fd810-83e1-4a29-85ea-8aa6204421e3" requests.packages.urllib3.disable_warnings(InsecureRequestWarning) bearertoken = "Bearer " + getToken() headers = { 'Authorization': bearertoken, 'Content-Type': "application/json" } response = requests.request("GET", url, headers=headers, verify=False) print(response.text) print(response.json)