Update fields for an asset and collections of assets. Only the name and tags can be modified.
Using the NOT EQUALS operator for updating assets could result in an accidental update of unknown assets without any warning. To prevent accidental updates of unknown assets, we do not support the NOT EQUALS operator for update actions.
Permissions required - Managers with full scope, and other users must have the requested assets in their scope and these permissions: Access Permission “API Access” and Asset Management Permission “Update Asset”.
We have restricted our asset update requests to static tags and have excluded dynamic tags. With this release, we will decline a request if the request contains TagSimple list having a dynamic tag for add/remove/set operation. The request is processed if it contains only static tags.
In case of the set operation, if the request includes static tags, then the existing static tags are removed and new static tags (specified in the request) are applied on that particular asset. All the existing system or dynamic tags are retained as is. You cannot add or remove dynamic tags manually.
API request
curl -u "USERNAME:PASSWORD" -H "Content-type: text/xml" -X "POST" --data-binary @- "<qualys_base_url>/qps/rest/2.0/update/am/asset/12345" < file.xml
Note: “file.xml” contains the request POST data.
Request POST data
<?xml version="1.0" encoding="UTF-8" ?>
<ServiceRequest>
<data>
<Asset>
<name>Updated Name</name>
</Asset>
</data>
</ServiceRequest>
Response
<?xml version="1.0" encoding="UTF-8"?>
<ServiceResponse
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="<qualys_base_url>/qps/xsd/2.0/am/asset.xsd">
<responseCode>SUCCESS</responseCode>
<count>1</count>
<data>
<Asset>
<id>12345</id>
<name>Updated Name</name>
<created>2014-02-06T19:16:35Z</created>
<modified>2014-02-06T19:16:35Z</modified>
<type>HOST</type>
<tags>
<list>
<TagSimple>
<id>12345</id>
<name>Tag 1</name>
</TagSimple>
<TagSimple>
<id>54321</id>
<name>Tag 2</name>
</TagSimple>
</list>
</tags>
</Asset>
</data>
</ServiceResponse>
API request
curl -u "USERNAME:PASSWORD" -H "Content-type: text/xml" -X "POST" --data-binary @- "<qualys_base_url>/qps/rest/2.0/update/am/asset" < file.xml
Note: “file.xml” contains the request POST data.
Request POST data
<?xml version="1.0" encoding="UTF-8" ?>
<ServiceRequest>
<filters>
<Criteria field="name" operator="CONTAINS">DELETED</Criteria>
<filters>
<data>
<Asset>
<tags>
<add>
<TagSimple>
<id>12345</id>
</TagSimple>
<add>
</tags>
</Asset>
</data>
</ServiceRequest>
XML output
<?xml version="1.0" encoding="UTF-8"?>
<ServiceResponse
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="<qualys_base_url>/qps/xsd/2.0/am/asset.xsd">
<responseCode>SUCCESS</responseCode>
<count>1</count>
<data>
<Asset>
<id>543</id>
<name>Old Asset (DELETED)</name>
<created>2014-02-06T19:16:35Z</created>
<modified>2014-02-06T19:16:35Z</modified>
<type>HOST</type>
<tags>
<list>
<TagSimple>
<id>12345</id>
<name>Tag 1</name>
</TagSimple>
</list>
</tags>
</Asset>
</data>
</ServiceResponse>
API request
curl -u "USERNAME:PASSWORD" -H "content-type: text/xml" -X "POST" -- "<qualys_base_url>/qps/rest/2.0/update/am/asset"< file.xml
Note: “file.xml” contains the request POST data.
Request POST data
<?xml version="1.0" encoding="UTF-8" ?>
<ServiceRequest>
<filters>
<Criteria field="id" operator="IN">8006386</Criteria>
<filters>
<data>
<Asset>
<tags>
<add>
<TagSimple>
<id>13745031</id>
</TagSimple>
<add>
</tags>
</Asset>
</data>
</ServiceRequest>
XML output
<?xml version="1.0" encoding="UTF-8"?>
<ServiceResponse
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="<qualys_base_url>/qps/xsd/2.0/am/asset.xsd">
<responseCode>SUCCESS</responseCode>
<count>1</count>
<data>
<Asset>
<id>8006386<
</id>
</Asset>
</data>
</ServiceResponse>
<platform API server>/qps/xsd/2.0/am/asset.xsd