Get Asset Details by ID
Use this API to retrieve the details of an asset in the
Control Compliance Suite
12.5 asset system. Provide asset GUID in input request to retrieve the asset 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 the following task to execute and use the Get Asset Details by ID API:
- View Assets
To use the Get Asset Details by ID API, you must have permission to access sub-folders in the Asset System folder. You may not require permissions on the entire 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 Details by ID API
Create a GET request by using the following components:
Request component | Value |
|---|---|
URL |
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 Details by ID API
The following table contains the description of the HTTPS request parameter for the Get Asset Details by ID API:
Field name | Field type | Data type | Description |
|---|---|---|---|
AssetID | Mandatory | GUID | This is the unique identifier of the asset of which you want to retrieve the details. |
Response body for Get Asset Details by ID API
The GET request for the Get Asset Details by ID API returns the response body in the following structure:
Success Response: { "DisplayName": "ID": "Type': "Path": "Attributes": [{...}] "symc-csm-AssetSystem-Asset-AssetBase-EvaluatedComplianceScores": " symc-csm-AssetSystem-Asset-AssetBase-EvaluatedRiskScores": "symc-csm-AssetSystem-Asset-AssetBase-MaxRiskScores": }
The Get Asset Details by ID API returns scores only if all the score properties are non-zero. If these properties are equal to zero, the API returns score properties with NA.
Sample HTTPS request for Get Asset Details by ID API
The following is a sample HTTPS request for your reference.
Request component | Value |
|---|---|
URL |
|
Content type | application/json |
Sample HTTPS response for Get Asset Details by ID API
The sample HTTPS request that you created earlier returns the following response:
{ "DisplayName":"<Domain name>\\<IP Address>", "ID":"b9be1cc2-bc95-4077-bff1-a68dadf0b3ef", "Path":"Asset System\\Windows", "Type":{"Name":"symc-csm-AssetSystem-Asset-Wnt-Machine","DisplayName":"Windows Machine","Description":null}, "Attributes":[{"Name":"symc-csm-AssetSystem-Asset-Wnt-Machine-DomainWorkgroupName","Value":"ccsdev","Values":null,"IsMultiValued":false}, {"Name":"symc-csm-AssetSystem-Asset-Wnt-Machine-HostName","Value":"10.211.105.169","Values":null,"IsMultiValued":false}, {"Name":"symc-csm-AssetSystem-Asset-Wnt-Machine-OSMajorVersionNumber","Value":6,"Values":null,"IsMultiValued":false}, {"Name":"symc-csm-AssetSystem-Asset-Wnt-Machine-OSMinorVersionNumber","Value":3,"Values":null,"IsMultiValued":false}, {"Name":"symc-csm-AssetSystem-Asset-Wnt-Machine-OSVersionType","Value":"Windows Server 2012 R2","Values":null,"IsMultiValued":false}, {"Name":"symc-csm-AssetSystem-Asset-Wnt-Machine-Server","Value":true,"Values":null,"IsMultiValued":false}, {"Name":"symc-csm-AssetSystem-Asset-Wnt-Machine-BDC","Value":null,"Values":null,"IsMultiValued":false}, {"Name":"symc-csm-AssetSystem-Asset-Wnt-Machine-PDC","Value":false,"Values":null,"IsMultiValued":false}, {"Name":"symc-csm-AssetSystem-Asset-Wnt-Machine-HostMachineInDomain","Value":null,"Values":null,"IsMultiValued":false}, {"Name":"symc-csm-AssetSystem-Asset-Wnt-Machine-HostNameDNS","Value":null,"Values":null,"IsMultiValued":false}, {"Name":"symc-csm-AssetSystem-Asset-Wnt-Machine-TCPIPAddresses","Value":null,"Values":[],"IsMultiValued":true}, {"Name":"symc-csm-AssetSystem-Asset-Wnt-Machine-SHAREPOINTVERSION","Value":null,"Values":null,"IsMultiValued":false}, {"Name":"symc-csm-AssetSystem-Asset-Wnt-Machine-IISVERSION","Value":null,"Values":null,"IsMultiValued":false}, {"Name":"symc-csm-AssetSystem-Asset-Wnt-Machine-VMWAREVCENTERSERVER","Value":null,"Values":null,"IsMultiValued":false}, {"Name":"symc-csm-AssetSystem-Asset-Wnt-Machine-APACHETOMCATSEREVR","Value":null,"Values":null,"IsMultiValued":false}, {"Name":"displayName","Value":"ccsdev\\10.211.105.169","Values":null,"IsMultiValued":false}, {"Name":"whenCreated","Value":"2018-02-13T06:25:11","Values":null,"IsMultiValued":false}, {"Name":"whenChanged","Value":"2018-06-19T10:22:08","Values":null,"IsMultiValued":false}, {"Name":"symc-csm-AssetSystem-Asset-AssetBase-Confidentiality","Value":0,"Values":null,"IsMultiValued":false}, {"Name":"symc-csm-AssetSystem-Asset-AssetBase-Integrity","Value":0,"Values":null,"IsMultiValued":false}, {"Name":"symc-csm-AssetSystem-Asset-AssetBase-Availability","Value":0,"Values":null,"IsMultiValued":false}, {"Name":"symc-csm-AssetSystem-Asset-AssetBase-Custodian","Value":null,"Values":null,"IsMultiValued":false}, {"Name":"symc-csm-AssetSystem-Asset-AssetBase-Department","Value":null,"Values":null,"IsMultiValued":false}, {"Name":"symc-csm-AssetSystem-Asset-AssetBase-Location","Value":null,"Values":null,"IsMultiValued":false}, {"Name":"symc-csm-AssetSystem-Asset-AssetBase-Owner","Value":null,"Values":null,"IsMultiValued":false}, {"Name":"symc-csm-AssetSystem-Asset-AssetBase-Site","Value":null,"Values":null,"IsMultiValued":false}, {"Name":"symc-csm-AssetSystem-Asset-AssetBase-SourceID","Value":null,"Values":null,"IsMultiValued":false}, {"Name":"symc-csm-AssetSystem-Asset-AssetBase-Source","Value":null,"Values":null,"IsMultiValued":false}, {"Name":"symc-csm-AS-CA-AF-341aa8ae-4b84-4ac9-b089-9a63413e1071","Value":null,"Values":null,"IsMultiValued":false}, {"Name":"symc-csm-AS-CA-AF-059021f9-e2e0-4a4f-ba2e-5fe8be03be43","Value":null,"Values":null,"IsMultiValued":false}], "symc-csm-AssetSystem-Asset-AssetBase-EvaluatedComplianceScores":"100", "symc-csm-AssetSystem-Asset-AssetBase-EvaluatedRiskScores":"0", ymc-csm-AssetSystem-Asset-AssetBase-MaxRiskScores":"0"}
HTTPS response codes for Get Asset Details by ID API
Depending on the success or the failure of your API request, you see the following response codes for the Get Asset Details by ID API:
Response Code | Response Type | Description |
|---|---|---|
200 | OK | The following asset details are retrieved:
|
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:
|
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:
|
500 | Internal Server Error (Server Error) | The following error message is displayed:
|
Sample Python script for Get Asset Details by ID API
Click to view a sample Python script for Get Asset Details by ID API
#Script to retrieve the details of an asset by providing asset 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 #GetAssetDetailsByAssetID API endpoint URL. Provide the Asset GUID in the request for getting the details for specific asset. #You can use SerachAsset API to get the GUID of the Asset. url = "https://" + HostName + ":" + PortNumber + "/ccs/api/v1/Assets/1169462b-e9bd-46f4-827a-7ac9b1a220d1" 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)