AnsweredAssumed Answered

QualysAPI - List Cloud Agents call via Python - API version issue

Question asked by smita patankar on May 8, 2020

qualys api Qualys Community Qualys Cloud Platform 



This is the working curl call:

curl -u xx:yy -X "POST" -H "X-Requested-With: curl" -H "Content-Type: text/xml" --data-binary @file.xml ""

file.xml contains:

<Criteria field="trackingMethod" operator="EQUALS">QAGENT</Criteria>
<Criteria field = "id" operator = "GREATER">0</Criteria>

I am trying to execute same call via python qualysapi module, but getting error related to api version. What am I missing? I tried sending api_version="2", its giving similar error.



from qualysapi import connect
conn = connect(username="xx", password="yy", hostname="")
api = "/qps/rest/2.0/search/am/hostasset"
parm = '''<ServiceRequest><preferences><limitResults>2</limitResults></preferences><filters><Criteria field="trackingMethod" operator="EQUALS">QAGENT</Criteria><Criteria field = "id" operator = "GREATER">0</Criteria></filters></ServiceRequest>'''
result = conn.request(api,parm)



?xml version="1.0" encoding="UTF-8"?>
<ServiceResponse xmlns:xsi="" xsi:noNamespaceSchemaLocation="">
<errorMessage>The API version v1.0 specified does not support objects of type 2.0.</errorMessage>
<errorResolution>Verify the versions supported for this API.</errorResolution>