Policy Import

POST/api/2.0/fo/compliance/policy/?action=import

Import a compliance policy, defined in an XML file, into your account. We’ll include all the service-provided controls from your XML file. You have the option to also include userdefined controls.

Permissions - If you’re not a Manager, the permission to Manage PC module must be turned on in your account.

Input ParametersInput Parameters

Parameter

Required/Optional

Data Type

Description

action=import

Required

String 

Specifies the action type for importing the policy.

echo_request={0|1}

Optional

Integer 

Specify 1 to view (echo) input parameters in the XML output. By default these are not included.

xml_file

Required

File 

File containing the policy details.

title={value}

Required

String 

The title of the new policy.

create_user_controls={0|1}

Optional

Integer 

When not specified, user-defined controls are not created when you import a policy. Specify 1 to include UDCs from the XML file.

Sample - Import PolicySample - Import Policy

API Request

https://<qualys_base_url>/api/2.0/fo/compliance/policy/?action=import&title=My+Policy"

XML Output

<!DOCTYPE SIMPLE_RETURN SYSTEM "https://<qualys_base_url>/api/2.0/simple_return.dtd">
<SIMPLE_RETURN>
   <RESPONSE>
      <DATETIME>2016-09-15T21:32:40Z</DATETIME>
      <TEXT>Successfully imported compliance policy</TEXT>
      <ITEM_LIST>
         <ITEM>
         <KEY>ID</KEY>
         <VALUE>136992</VALUE>
      </ITEM>
      <ITEM>
         <KEY>TITLE</KEY>
         <VALUE>My Policy</VALUE>
      </ITEM>
   </ITEM_LIST>
</RESPONSE>
</SIMPLE_RETURN>

Sample - Import Policy With UDCs Having Remediation Information Using XML FileSample - Import Policy With UDCs Having Remediation Information Using XML File

API Request

curl -u "USERNAME:PASSWORD" -H "X-Requested-With: curl" -H Content-Type:text/xml --data-binary "@UDC_with_Remedy_20200422.xml" "https://<qualys_base_url>/api/2.0/fo/compliance/policy/?action=import&title=Policy1&create_user_controls=1"

XML Output

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE SIMPLE_RETURN SYSTEM
"https://<qualys_base_url>/api/2.0/simple_return.dtd">
<SIMPLE_RETURN>
  <RESPONSE>
    <DATETIME>2020-04-22T22:51:16Z</DATETIME>
    <TEXT>Successfully imported compliance policy</TEXT>
    <ITEM_LIST>
      <ITEM>
        <KEY>ID</KEY>
        <VALUE>1867541</VALUE>
      </ITEM>
      <ITEM>
        <KEY>TITLE</KEY>
        <VALUE>Policy1</VALUE>
      </ITEM>
    </ITEM_LIST>
  </RESPONSE>
</SIMPLE_RETURN>

DTD

<platform API server>/api/2.0/simple_return.dtd