AnsweredAssumed Answered

How to detect error responses from Qualys API V2

Question asked by Mir Dard on Mar 26, 2018
Latest reply on Mar 27, 2018 by Mir Dard

Hello,

 

Maybe I'm missing something simple.  What's the standard way for detecting API errors?  I find that sometimes the API returns errors inside 200 OK HTTP code as shown below and at other times it uses HTTP 400 codes.    I was hoping I could rely on the HTTP response code to identify errors versus successful requests.

 

Thank you!

 

POST /api/2.0/fo/scan/ HTTP/1.1

action=launch&scan_titles=test&...

 

HTTP/1.1 200 OK

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE SIMPLE_RETURN SYSTEM "https://qualysapi.qg2.apps.qualys.com/api/2.0/simple_return.dtd">
<SIMPLE_RETURN>
  <RESPONSE>
    <DATETIME>2018-03-21T18:57:51Z</DATETIME>
    <CODE>1901</CODE>
    <TEXT>Unrecognized parameter(s): scan_titles (action=launch allows: echo_request, scan_title, option_id, option_title, priority, iscanner_id, iscanner_name, default_scanner, scanners_in_ag, scanners_in_tagset, include_agent_targets, runtime_http_header, ip, asset_group_ids, asset_groups, exclude_ip_per_scan, target_from, tag_include_selector, tag_exclude_selector, use_ip_nt_range_tags, tag_set_by, tag_set_include, tag_set_exclude, connector_uuid, connector_name, ec2_endpoint, ec2_only_classic)</TEXT>
  </RESPONSE>
</SIMPLE_RETURN>

 

=============

POST /api/2.0/fo/scan/ HTTP/1.1

action=launch&scan_title=Test&ip=10.0.0.0&iscanner_name=99999

 

HTTP/1.1 200 OK

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE SIMPLE_RETURN SYSTEM "https://qualysapi.qg2.apps.qualys.com/api/2.0/simple_return.dtd">
<SIMPLE_RETURN>
  <RESPONSE>
    <DATETIME>2018-03-21T18:31:25Z</DATETIME>
    <CODE>1903</CODE>
    <TEXT>Missing required parameter(s): option_id, option_title (request must be set at least one of option_id or option_title)</TEXT>
  </RESPONSE>
</SIMPLE_RETURN>

Outcomes