AnsweredAssumed Answered

Create Host Asset (AM) API Fails

Question asked by Joe Kraxner on Mar 13, 2014
Latest reply on Mar 14, 2014 by Joe Kraxner

I’ve run into a bit of an issue with the AssetManagement API. I'm having trouble with the "Create Host Asset" APIexample documented on page 32 of the "QualysGuard Asset Management andTagging API User Guide Version 2.2" (January 29, 2014). Using the examplein the User’s Guide, it fails with an error:

 

“Error while saving a domainobject of type [com.qualys.portal.application.module.asset.domain.asset.HostAsset]:Error while committing the transaction”

 

I even compared the “file.xml” in thetest below with the XML Schema document (hostasset.xsd) and every appears to beformatted properly.

 

Unfortunately the example is not very simple innature and there is no documentation supporting which elements/fields arerequired fields to make it work successfully. When removing the extra elements(open ports, vulns) it still fails. I've tried several different permutationsincluding running a get host asset and stripping down the output and matchingthe XML element names to make sense.

 

Below is the basic example and I attached arethe files that reflect my testing, I welcome any assistance. Note: I changed the Tag to one that is relevantto my QG environment.

 

Curl Request:

curl -u "joeschmoe:mysecret" -H "Content-type: text/xml" -X "POST" --data-binary @- "https://qualysapi.qg2.apps.qualys.com/qps/rest/1.0/create/am/hostasset" < file.xml

 

Curl Response:

<?xml version="1.0" encoding="UTF-8"?>

<ServiceResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://qualysapi.qg2.apps.qualys.com/qps/xsd/1.0/am/hostasset.xsd">

  <responseCode>INVALID_REQUEST</responseCode>

  <responseErrorDetails>

    <errorMessage>Error while saving a domain object of type [com.qualys.portal.application.module.asset.domain.asset.HostAsset]: Error while committing the transaction</errorMessage>

  </responseErrorDetails>

</ServiceResponse>

 

Has anyone been able to get this to successfully work?

 

Thank you.

 

Joe Kraxner


Outcomes