Delete Standards

Use this API to delete a specified standard or a list of standards from the
Control Compliance Suite
system. You can delete up to 10 standards per request.
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 Delete Standards API:
  • View standards
  • Manage Standards
To use the Delete Standards API, you must have the permission to access sub-folders in the Standards folder. You may not require permissions on the entire Standards hierarchy.
  Request method
To delete a standard, create a
DELETE
request.
  HTTPS request components for Delete Standards API
Create a DELETE request by using the following components:
HTTPS request components for Delete Standards API
Request component
Value
URL
https://<hostname>:<port number>/ccs/api/v1/Standards
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
'{"StandardList":[{"Type":"ID","Standards":["<standard GUID>", "<standard GUID>","<standard GUID>"]}, {"Type":"Name","Standards":["<Name of the standard>"]}], "ContainerPath":"<Container path value>","DeleteFromSubfolder":"Ture/False","DeletePredefinedStandard":"True/False"}'
HTTPS request parameters for Delete Standards API
The following table contains the description of the HTTPS request parameters for the Delete Standards API. You must use these parameters in the StandardList array as displayed in HTTPS request components for Delete Standards API
HTTPS request parameters for Delete Standards API
Field name
Field type
Data type
Description
Type
Mandatory
String
These are the ways by which you want to list standards that you want to delete. The following types of standard lists are supported:
  • ID
    If you use this field in the request, the
    Standards
    field must contain the GUIDs of the standards that you want to delete.
  • Name
    If you use this field in the request, the
    Standards
    field must contain the exact names of the standards that you want to delete.
These types are not case sensitive. You can use either of or both these types in an input request.
Standards
Mandatory
GUID (if you use ID as the StandardList type)
String (if you use Name as the StandardList type)
Depending on the StandardList type, this field contains GUIDs or names of the standards that you want to delete.
ContainerPath
Optional
String
This is the folder in which the delete operation is executed. The default value of this parameter is Standards, which is the default root folder in the
Control Compliance Suite
standards hierarchy.
DeleteFromSubfolder
Optional
String
By using this parameter, you can decide whether to delete a standard from a subfolder in your standard. The default value of this parameter is 'False'.
DeletePredefinedStandard
Optional
String
By using this parameter, you can decide whether to a predefined standard. The default value of this parameter is 'False'.
Sample HTTPS request for Delete Standards API
The following is a sample HTTPS request for your reference:
Sample HTTPS request for Delete Standards API
Request component
Value
URL
https://<hostname>:<port number>/ccs/api/v1/Standards
Content type
application/json
JSON body
'{"StandardList":[{"Type":"ID","Standards":["54E94600-F4B0-415D-8AD0-07D99FB82808", "F8E09999-F40B-4CA9-9C8C-160DDA0DF88D","D9944B0A-2EB9-4D15-A66F-6BC855D3593F"]}, {"Type":"Name","Standards":["Copy of File Names Standard"]}], "ContainerPath":"standards\\std","DeleteFromSubfolder":"False","DeletePredefinedStandard":"False"}'
  Response body for Delete Standards API
The DELETE request for the Delete Standards API returns the response body in the following structure:
{ "StandardsNotFound":[..,.., "Remark: These standards could not be deleted because of one of the following reasons: 1. Insufficient permissions 2. Invalid ID or name 3. Invalid container path."] "PredefinedStandards":[..,.., "Remark: To delete a predefined standard, set the 'DeletePredefinedStandard' field to True in the JSON input.] }
  Sample HTTPS response for Delete Standards API
The sample HTTPS request that you created earlier returns the following response:
OK {"PredefinedStandards":{"d9944b0a-2eb9-4d15-a66f-6bc855d3593f":"Security Essentials for Apache Tomcat Server 5.x - 8.x", "Remark":"To delete a predefined standard, set the 'DeletePredefinedStandard' field to True in the JSON input."}, "StandardsNotFound":["Copy of File Names Standard","54E94600-F4B0-415D-8AD0-07D99FB82808","F8E09999-F40B-4CA9-9C8C-160DDA0DF88D", "Remark: These standards could not be deleted because of one of the following reasons: 1. Insufficient permissions 2. Invalid ID or name 3. Invalid container path"]}
HTTPS response codes for Delete Standards API
Depending on the success or the failure of your API request, you see the following response codes for the Delete Standards API:
HTTPS response codes for Delete Standards API
Response Code
Response Type
Description
200
OK
The request is successfully completed. The list of standards that are not found during the execution of the DELETE operation is displayed along with the following remark.
{ "StandardsNotFound":[..,.., "Remark: These standards could not be deleted because of one of the following reasons: 1. Insufficient permissions 2. Invalid ID or name 3. Invalid container path."]
If you add a predefined standard in the StandardList parameter, and if the value of the DeletePredefinedStandard parameter is False, it is displayed in the PredefinedStandards list along with the following remark:
"PredefinedStandards":[..,.., "Remark: To delete a predefined standard, set the 'DeletePredefinedStandard' field to True in the JSON input.]
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.
403
Forbidden
This may be because the identified user does not have proper authorization to delete a standard in
Control Compliance Suite
.
404
NOT found
The standard ID that is specified in the request does not exist in the
Control Compliance Suite
system.
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 Delete Standards API
Click to view a sample Python script for Delete Standards API
# Script to Delete the Standard from 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 Standard URI url = "https://" + HostName + ":" + PortNumber + "/ccs/api/v1/Standards" # Provide the standard details which need to be deleted. we can provide standard name or standard GUID payload = "{\"StandardList\":[{\"Type\":\"Name\",\"Standards\":[\"Test Standard for AIX\",\"Test Windows 2012\"]},{\"Type\":\"ID\",\"Standards\":[\"77fd3e2e4e7e1800-3775-4ba8-9b9d-37d16cccd5a7\",\"3a9abc89-ae28-46ec-ab6f-0885e40e90e1\",\"78d3c003-5f02-4d39-82b8-a90a8613167c\"]}],\"ContainerPath\":\"standards\",\"DeletePredefinedStandard\":\"false\"}" requests.packages.urllib3.disable_warnings(InsecureRequestWarning) bearertoken = "Bearer " + getToken() headers = { 'Authorization': bearertoken , 'Content-Type': "application/json" } response = requests.request("DELETE", url, data=payload, headers=headers, verify=False) print(response.text) print(response.json)