Create Asset (for agentless data collection only )

Use this API to create an asset or multiple assets in the
Control Compliance Suite
asset system. This API can be used only to create assets for the agentless data collection method of
Control Compliance Suite
.
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 tasks to use the Create Asset API:
  • View assets
  • Manage assets and asset groups
To use the Create Asset 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 create an asset by using a technical standard, create a
POST
request.
HTTPS request components for Create Asset API
Create a POST request by using the following components:
HTTPS request components for Create Asset API
Request component
Value
URL
https://<hostname>:<port number>/ccs/api/v1/assets
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
JSON body
[ { "Type" : "symc-csm-AssetSystem-Asset-Wnt-Machine", "symc-csm-AssetSystem-Asset-Wnt-Machine-HostName" : "<hostname>", "symc-csm-AssetSystem-Asset-Wnt-Machine-DomainWorkgroupName" : "<domain name>" } ,{ "Type" : "symc-csm-AssetSystem-Asset-Cisco-Router", "symc-csm-AssetSystem-Asset-Cisco-Router-IPAddress" : "<IP>" } , { "Type" : "symc-csm-AssetSystem-Asset-Unix-MySQL-Servers", "symc-csm-AssetSystem-Asset-Unix-MySQL-Servers-HOSTMACHINE" : "<hostname>", "symc-csm-AssetSystem-Asset-Unix-MySQL-Servers-IPAddress" : "<IP>", "symc-csm-AssetSystem-Asset-Unix-MySQL-Servers-InstancePortNumber" : "<Number>" } ,{ "Type" : "symc-csm-AssetSystem-Asset-Unix-Machine", "symc-csm-AssetSystem-Asset-Unix-Machine-IPAddress" : "IP" , "symc-csm-AssetSystem-Asset-Unix-Machine-HostMachine" : "<hostname>" } ,{ "Type" : "symc-csm-AssetSystem-Asset-Dbif-server", "symc-csm-AssetSystem-Asset-Dbif-server-SQLServerDomainName" : "<domain name>" , "symc-csm-AssetSystem-Asset-Dbif-server-hostName" : "<hostname>" , "symc-csm-AssetSystem-Asset-Dbif-server-serverName" : "<server name>" } ,{ "Type" : "symc-csm-AssetSystem-Asset-Unix-MySQL-Servers", "container" : "Assets\\", "symc-csm-AssetSystem-Asset-Unix-MySQL-Servers-HOSTMACHINE" : "<hostname>", "symc-csm-AssetSystem-Asset-Unix-MySQL-Servers-IPAddress" : "<IP>", "symc-csm-AssetSystem-Asset-Unix-MySQL-Servers-InstancePortNumber" : <Number> } ]
HTTPS request parameters for Create Asset API
The following table contains the description of the HTTPS request parameters for the Create Asset API. The parameters vary depending on the platform for which you create the request.
The optional fields in the following tables are marked as optional for asset creation only. They may be mandatory for data collection on assets.
HTTPS request parameters for Windows
HTTPS request parameters for Windows
Field name
Corresponding UI label
Field type
Data type
Description
Type
On the console, in the
Add Assets
wizard, on the
Select Creation Option
screen, the
Asset Type
list
Mandatory
String
The value of this parameter must be
symc-csm-AssetSystem-Asset-Wnt-Machine
.
symc-csm-AssetSystem-Asset-Wnt-Machine-HostName
Machine Name
Mandatory
String
The value of this parameter must be the host name of the Windows asset that you want to create.
symc-csm-AssetSystem-Asset-Wnt-Machine-DomainWorkgroupName
Domain/Workgroup Name
Mandatory
String
The value of this parameter must be the domain name or the workgroup name of the asset that you want to create.
symc-csm-AssetSystem-Asset-Wnt-Machine-OSVersionType
OS Type
Optional
String
The value of this parameter must be the Windows version of the asset that you want to create.
For example,
Microsoft Windows Server 2008 Enterprise version 6.0 Service Pack 2 (Build 6002)
symc-csm-AssetSystem-Asset-Wnt-Machine-OSMajorVersionNumber
OS Major Version Number
Optional
Int
The value of this parameter must be the supported major version of the Windows operating system of the asset that you want to create.
symc-csm-AssetSystem-Asset-Wnt-Machine-OSMinorVersionNumber
OS Minor Version Number
Optional
Int
The value of this parameter must be the supported minor version of the Windows operating system of the asset that you want to create.
HTTPS request parameters for UNIX
HTTPS request parameters for UNIX
Field name
Corresponding UI label
Field type
Data type
Description
Type
On the console, in the
Add Assets
wizard, on the
Select Creation Option
screen, the
Asset Type
list
Mandatory
String
The value of this parameter must be
symc-csm-AssetSystem-Asset-Unix-Machine
.
symc-csm-AssetSystem-Asset-Unix-Machine-HostMachine
Machine Name
Mandatory
String
Provide the host name of the UNIX asset that you want to create.
symc-csm-AssetSystem-Asset-Unix-Machine-IPAddress
IP Address
Mandatory
String
Provide the IP address of the UNIX asset that you want to create.
symc-csm-AssetSystem-Asset-Unix-Machine-OSDistributionField
Operating Distribution Field
Optional
String
Provide the distribution details of the operating system of the asset that you want to create.
For example, for an RHEL asset, the value of this field can be
Red Hat Enterprise Linux Server x86_64
symc-csm-AssetSystem-Asset-Unix-Machine-OSSystem
Operating System
Optional
String
This is the name of the host operating system of the UNIX asset that you want to create.
symc-csm-AssetSystem-Asset-Unix-Machine-OSVersionString
Operating System Version
Optional
String
This is the version of the operating system of the UNIX asset that you want to create.
HTTPS request parameters for MS SQL Server
HTTPS request parameters for MS SQL Server
Field name
Corresponding UI Label
Field type
Data type
Description
Type
On the console, in the
Add Assets
wizard, on the
Select Creation Option
screen, the
Asset Type
list
Mandatory
String
The value of this parameter must be
symc-csm-AssetSystem-Asset-Dbif-server
.
symc-csm-AssetSystem-Asset-Dbif-server-SQLServerDomainName
Domain/Workgroup Name
Mandatory
String
The value of this parameter must be the domain name of the MS SQL Server asset that you want to create.
symc-csm-AssetSystem-Asset-Dbif-server-hostName
Host Name (Node)
Mandatory
String
The value of this parameter must be the host name of the MS SQL Server asset that you want to create.
symc-csm-AssetSystem-Asset-Dbif-server-serverName
Server Name (Instance)
Mandatory
String
The value of this parameter must be the server name of the MS SQL Server asset that you want to create.
symc-csm-AssetSystem-Asset-Dbif-server-operatingSystem
Operating System
Optional
String
The value of this parameter must be the Windows operating system version of the MS SQL Server asset that you want to create; for example, 6.3 (14393)
symc-csm-AssetSystem-Asset-Dbif-server-platform
Platform
Optional
String
The value of this parameter must be the OS architecture details of the MS SQL Server asset; for example, NT x64.
symc-csm-AssetSystem-Asset-Dbif-server-productLevel
Product Level
Optional
String
The value of this parameter must be the product level of the MS SQL Server asset; for example, RTM.
symc-csm-AssetSystem-Asset-Dbif-server-productVersion
Product Version
Optional
String
The value of this parameter must be the product version of the MS SQL Server asset; for example, 14.0.1000.169.
symc-csm-AssetSystem-Asset-Dbif-server-versionString
Version String
Optional
String
The value of this parameter must be version string of the MS SQL Server Asset; for example, Microsoft SQL Server 2017 (RTM) - 14.0.1000.169 (X64) Aug 22 2017 17:04:49 Copyright (C) 2017 Microsoft Corporation Standard Edition (64-bit) on Windows Server 2016 Standard 10.0 <X64> (Build 14393: ) (Hypervisor)
HTTPS request parameters for Oracle database
HTTPS request parameters for Oracle database
Field name
Corresponding UI label
Field type
Data type
Description
Type
On the console, in the
Add Assets
wizard, on the
Select Creation Option
screen, the
Asset Type
list
Mandatory
String
The value of this parameter must be
symc-csm-AssetSystem-Asset-ORCL-CONFIGUREDDATABASES
.
symc-csm-AssetSystem-Asset-ORCL-CONFIGUREDDATABASES-NetBIOSName
Server NetBIOS Name
Mandatory
String
The value of this parameter must be the NetBIOS name of the Oracle database asset that you want to create.
symc-csm-AssetSystem-Asset-ORCL-CONFIGUREDDATABASES-DomainOrIP
Windows Domain Name or Unix IP Address
Mandatory
String
The value of this parameter must be the IP address of the Oracle database asset that you want to create.
symc-csm-AssetSystem-Asset-ORCL-CONFIGUREDDATABASES-servername
FQDN
Mandatory
String
The value of this parameter must be the server name of the Oracle database asset that you want to create.
symc-csm-AssetSystem-Asset-ORCL-CONFIGUREDDATABASES-dbname
Database Name
Mandatory
String
The value of this parameter must be the database name of the asset that you want to create.
symc-csm-AssetSystem-Asset-ORCL-CONFIGUREDDATABASES-dbversion
Database Version
Optional
String
The value of this parameter must be the database version of the asset that you want to create.
symc-csm-AssetSystem-Asset-ORCL-CONFIGUREDDATABASES-OSTYPE
OS Type
Optional
String
The value of this parameter must be the host operating system type of the database asset that you want to create.
symc-csm-AssetSystem-Asset-ORCL-CONFIGUREDDATABASES-OSVERSION
Operating System Version
Optional
String
The value of this parameter must be the version of the operating system of the database asset that you want to create.
You can create an Oracle asset by using the mandatory attributes listed in the
HTTPS request parameters for Oracle database
table. To execute data collection on Oracle assets, you must add the optional attributes listed in the same table.
Sample HTTPS request for Create Asset API
The following is a sample HTTPS request for your reference.
HTTPS request components for Create Asset API
Request component
Value
URL
https://<hostname>:<port number>/ccs/api/v1/assets
Content type
application/json
JSON body
[ { "Type" : "symc-csm-AssetSystem-Asset-Wnt-Machine", "symc-csm-AssetSystem-Asset-Wnt-Machine-HostName" : "TestWinAsset", "symc-csm-AssetSystem-Asset-Wnt-Machine-DomainWorkgroupName" : "TestDomain" } ,{ "Type" : "symc-csm-AssetSystem-Asset-Cisco-Router", "symc-csm-AssetSystem-Asset-Cisco-Router-IPAddress" : "10.211.11.11" } , { "Type" : "symc-csm-AssetSystem-Asset-Unix-MySQL-Servers", "symc-csm-AssetSystem-Asset-Unix-MySQL-Servers-HOSTMACHINE" : "testredhatx86", "symc-csm-AssetSystem-Asset-Unix-MySQL-Servers-IPAddress" : "10.211.88.11", "symc-csm-AssetSystem-Asset-Unix-MySQL-Servers-InstancePortNumber" : "5704" } ,{ "Type" : "symc-csm-AssetSystem-Asset-Unix-Machine", "symc-csm-AssetSystem-Asset-Unix-Machine-IPAddress" : "10.211.66.140" , "symc-csm-AssetSystem-Asset-Unix-Machine-HostMachine" : "rhel6" } ,{ "Type" : "symc-csm-AssetSystem-Asset-Dbif-server", "symc-csm-AssetSystem-Asset-Dbif-server-SQLServerDomainName" : "TestDomain" , "symc-csm-AssetSystem-Asset-Dbif-server-hostName" : "MySQLHost" , "symc-csm-AssetSystem-Asset-Dbif-server-serverName" : "TestSQLServerAsset" } ,{ "Type" : "symc-csm-AssetSystem-Asset-Unix-MySQL-Servers", "container" : "Assets\\", "symc-csm-AssetSystem-Asset-Unix-MySQL-Servers-HOSTMACHINE" : "AKwin2012r2", "symc-csm-AssetSystem-Asset-Unix-MySQL-Servers-IPAddress" : "10.211.78.98", "symc-csm-AssetSystem-Asset-Unix-MySQL-Servers-InstancePortNumber" : 5701 } ]
  Sample HTTPS response for Create Asset API
{ "Total assets requested": 6, "Total assets created": 6, "Details of created assets": [ { "RecordID": 1, "DisplayName": "TestDomain\\TestWinAsset", "Path": "Asset System", "ID": "c92f6f8a-8808-4c92-ac53-6390b75c57a0", "Type": "symc-csm-AssetSystem-Asset-Wnt-Machine" }, { "RecordID": 2, "DisplayName": "10.211.11.11", "Path": "Asset System", "ID": "e3410909-19f6-49dc-a705-039a355ce8b2", "Type": "symc-csm-AssetSystem-Asset-Cisco-Router" }, { "RecordID": 3, "DisplayName": "testredhatx86:10.211.88.11:5704", "Path": "Asset System", "ID": "38d28bab-fcb4-43cd-bcd7-4952e8b624f1", "Type": "symc-csm-AssetSystem-Asset-Unix-MySQL-Servers" }, { "RecordID": 4, "DisplayName": "rhel6:10.211.66.140", "Path": "Asset System", "ID": "c8c92c7c-5f0a-493c-af7c-abf7196a7130", "Type": "symc-csm-AssetSystem-Asset-Unix-Machine" }, { "RecordID": 5, "DisplayName": "TestSQLServerAsset", "Path": "Asset System", "ID": "9c1c82e4-83dc-4fdf-84fa-7ae06d4b1f4e", "Type": "symc-csm-AssetSystem-Asset-Dbif-server" }, { "RecordID": 6, "DisplayName": "AKwin2012r2:10.211.78.98:5701", "Path": "Asset System\\Assets", "ID": "9b5d217e-9b78-4ecb-a154-2d87bb206844", "Type": "symc-csm-AssetSystem-Asset-Unix-MySQL-Servers" } ], "Details of failed assets": [] }
HTTPS response codes for Create Asset API
Depending on the success or the failure of your API request, you see the following response codes for the Create Asset API:
HTTPS response codes for Create Asset API
Response Code
Response Type
Description
201
Created
This response is returned in one of the following situations:
  • All the specified assets are created.
  • Some of the specified assets are created (partial asset creation).
200
(with Total Count: 0 in response body)
OK
The request is successfully completed. The total count of assets created in this case is zero.
403
Forbidden
The following error message is displayed:
You are not authorized to perform this task. Access is denied.
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:
Server could not understand the request due to invalid syntax. Please check requested URL.
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 Create Asset API
Click to view a sample Python script for Create Asset API
# Script to create an asset or add an asset in the CCS system import requests from requests.packages.urllib3.exceptions import InsecureRequestWarning # Variable # 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'] print("bearer Token is:\n") print(token) print("\n Refresh Token is:\n") print(refreshToken) return token # CCS REST Assets URI url = "https://" + HostName + ":" + PortNumber + "/ccs/api/v1/assets" # Payload for adding single windows asset payload = "[{ \"Type\" : \"symc-csm-AssetSystem-Asset-Wnt-Machine\",\"symc-csm-AssetSystem-Asset-Wnt-Machine-HostName\" : \"MyWinAsset\",\"symc-csm-AssetSystem-Asset-Wnt-Machine-DomainWorkgroupName\" : \"NewDomain\" }]" # Payload for adding multiple assets #payload = "[{\"Type\" : \"symc-csm-AssetSystem-Asset-Wnt-Machine\",\"symc-csm-AssetSystem-Asset-Wnt-Machine-HostName\" : \"MytestWinAsset7\",\"symc-csm-AssetSystem-Asset-Wnt-Machine-DomainWorkgroupName\" : \"MyDomain\"},{\"Type\" : \"symc-csm-AssetSystem-Asset-Cisco-Router\",\"symc-csm-AssetSystem-Asset-Cisco-Router-IPAddress\" : \"10.211.886.888\"},{\"Type\" : \"symc-csm-AssetSystem-Asset-Unix-MySQL-Servers\",\"symc-csm-AssetSystem-Asset-Unix-MySQL-Servers-HOSTMACHINE\" : \"testredhatx86123\",\"symc-csm-AssetSystem-Asset-Unix-MySQL-Servers-IPAddress\" : \"10.211.88.111\",\"symc-csm-AssetSystem-Asset-Unix-MySQL-Servers-InstancePortNumber\" : \"5704\"},{\"Type\" : \"symc-csm-AssetSystem-Asset-Unix-Machine\",\"symc-csm-AssetSystem-Asset-Unix-Machine-IPAddress\" : \"10.211.66.119\" ,\"symc-csm-AssetSystem-Asset-Unix-Machine-HostMachine\" : \"rhelx86789\"},{\"Type\" : \"symc-csm-AssetSystem-Asset-Dbif-server\",\"symc-csm-AssetSystem-Asset-Dbif-server-SQLServerDomainName\" : \"MyDomain\",\"symc-csm-AssetSystem-Asset-Dbif-server-hostName\" : \"MySQLHost1\",\"symc-csm-AssetSystem-Asset-Dbif-server-serverName\" : \"SQLServerAsset\"},{\"Type\" : \"symc-csm-AssetSystem-Asset-Unix-MySQL-Servers\",\"container\" : \"Assets\",\"symc-csm-AssetSystem-Asset-Unix-MySQL-Servers-HOSTMACHINE\" : \"AKwin2012r2\",\"symc-csm-AssetSystem-Asset-Unix-MySQL-Servers-IPAddress\" : \"10.211.98.98\",\"symc-csm-AssetSystem-Asset-Unix-MySQL-Servers-InstancePortNumber\" : \"5701\"}]" requests.packages.urllib3.disable_warnings(InsecureRequestWarning) bearertoken = "Bearer " + getToken() headers = { 'Authorization': bearertoken , 'Content-Type': "application/json" } response = requests.request("POST", url, data=payload, headers=headers, verify=False) print(response.text) print(responce.json)