I'm attempting to get the number of web application scans that ran for a specified date range. I also, want to filter based on the end result of the scan (FINISHED, ERROR, etc.). I've been reading the documentation and I'm not finding it very clear as to how the XML should be formatted.
<ServiceRequest> <data> <WebApp> <lastScan.date Date="GREATER">2012-05-01T24:00:00Z</lastScan.date> <lastScan.date Date="LESSER">2012-05-08T24:00:00Z</lastScan.date> <lastScan.status Keyword="EQUALS">FINISHED</lastScan.status> </WebApp> </data> </ServiceRequest>
My curl request looks like this:
curl -u "UserName:Password" -H "content-type: text/xml" -X "POST" -d @- "https://qualysapi.qualys.com/qps/rest/3.0/search/was" < scansFinished.xml
When I send that request, I get nothing back. So, the XML is obviously completely wrong. Any help would be much appreciated.
I started using the verbose parameter with curl and have a lot more to work off of now. I found that my URL was incorrect. It should be:
Still working on the XML. At least I have some error messages to help me out now.
Here is the correct syntax for the input XML:
<Criteria field="lastScan.date" operator="GREATER">2012-05-01T0:00:00Z</Criteria>
<Criteria field="lastScan.date" operator="LESSER">2012-05-08T0:00:00Z</Criteria>
<Criteria field="lastScan.status" operator="EQUALS">FINISHED</Criteria>
Let me know if it works for you. In addition to the user guide, you can refer to the comments in the XSD to understand how to write the input XML
Thank you very much for your help. This definitely clears things up a bit. Just one more question. When using the logical AND, how would that be formatted? I've tried a number of different ways, but can't seem to get a successful result. My XML looks like this:
<Criteria field="lastScan.status" operator="EQUALS">FINISHED AND ERROR</Criteria>
Again, thank you for your time.
In order to pass multiple values, we need to use the IN operator and comma as separator for the different options. So in your example this should be:
<Criteria field="lastScan.status" operator="IN">FINISHED,ERROR</Criteria>