AnsweredAssumed Answered

Search Host Assets API endpoint returning empty results after hanging

Question asked by Alexandre Philbert on May 2, 2019
Latest reply on May 3, 2019 by briandra3

I am having trouble getting results from the search host assets API endpoint. I am capable of getting results using, for example, id as a field and putting in an assetId. I wish to be able to query for less specific things like tag names, operating systems, etc.

 

filter.xml:

<?xml version="1.0" encoding="UTF-8" ?>
  <ServiceRequest>
    <preferences>
      <limitResults>1</limitResults>
    </preferences>
    <filters>
      <Criteria field="os" operator="CONTAINS">Linux</Criteria>
    </filters>
</ServiceRequest>

 

cURL command:

curl -u <user>:<pass> -X POST -H "X-Requested-With: curl" -H "Content-Type: text/xml" -H "Cache-Control: no-cache" --data-binary @filter.xml "https://qualysapi.qg2.apps.qualys.com/qps/rest/2.0/search/am/hostasset/"

 

Response:

curl: (52) Empty reply from server

 

Is there something obvious that I am doing wrong or should I open a Qualys support case?

 

UPDATE:

When I avoid using the "os" filter it stopped returning empty results (doesn't make sense since in the UI I use the "operatingSystem" filter just fine), but still the API is really slow compared to the UI. For example, I can go in the Asset View filter in the web UI and donload a CSV of all the assets that corresponds to a filter very quickly; but, using the API, it takes way more time (a few minutes per 100 hosts) even if I filter to only have asset IDs returned.

 

UPDATE 2:

Also, I get this error sometimes:
requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(54, 'Connection reset by peer'))

Outcomes