Get all Remediation ticket with ticket_list.php API

Document created by Eric Perraudeau Employee on Dec 11, 2012Last modified by Simon Adams on Jan 8, 2014
Version 2Show Document
  • View in full screen mode

The API "ticket_list.php" returns the list of ticket into multiple pages of 1000 tickets. This API output is paginated because we don't want to overflow the client with too much data, which is something that could happen easily with large XML dataset.

 

So the first request returns 1,000 tickets and there is a special XML tag that tells the user how to download the next page if the page limit has been reached.

 

Here is an example:

The following request returns an XML output that contains a list of <TICKET> according the the DTD https://qualysapi.qualys.com/ticket_list_output.dtd:


curl -u "$USER:$PASS" "https://qualysapi.qualys.com/msp/ticket_list.php?show_vuln_details=1&modified_since_datetime=2011-01-01


Example:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE REMEDIATION_TICKETS SYSTEM "https://qualysapi.qualys.com/ticket_list_output.dtd">
<REMEDIATION_TICKETS>
  <HEADER>[...]</HEADER>
  <TICKET_LIST>
    <TICKET>
      <NUMBER>1</NUMBER>
      <CREATION_DATETIME>2005-06-28T13:32:02Z</CREATION_DATETIME>
      <DUE_DATETIME>2005-08-24T08:55:53Z</DUE_DATETIME>
      <CURRENT_STATE>OPEN</CURRENT_STATE>
      <CURRENT_STATUS>REOPENED</CURRENT_STATUS>
      <INVALID>0</INVALID>
      <ASSIGNEE>[...]</ASSIGNEE>
      <DETECTION>[...]</DETECTION>
      <STATS>[...]</STATS>
      <HISTORY_LIST>[...]</HISTORY_LIST>
      <VULNINFO>[...]</VULNINFO>
      <DETAILS>[...]</DETAILS>
    </TICKET>
    <TICKET>[...]</TICKET>
  </TICKET_LIST>
</REMEDIATION_TICKETS>

The maximum number of <TICKET> is limited to 1,000. If the request returns more than 1,000 tickets, then the output is paginated. The first page will contain the first 1,000 tickets, that are sorted by their <NUMBER>, and a <TRUNCATION> tag that indicates how to fetch the next page. The same logic applies to all the consequent pages until the last page is reached. The last page doesn’t contain the <TRUNCATION> tag.

Example of the end of a page with the <TRUNCATION> tag:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE REMEDIATION_TICKETS SYSTEM "https://qualysapi.qualys.com/ticket_list_output.dtd">
<REMEDIATION_TICKETS>
  <HEADER>[...]</HEADER>
  <TICKET_LIST>
    <TICKET>[...]</TICKET>
    <TICKET>[...]</TICKET>
    <TICKET>[...]</TICKET>
  </TICKET_LIST>
  <TRUNCATION last="38084">Truncated after 1000 records</TRUNCATION>
</REMEDIATION_TICKETS>

 

In this example, the request to get the next page is:

curl -u "$USER:$PASS" "https://qualysapi.qualys.com/msp/ticket_list.php?show_vuln_details=1&modified_since_datetime=2011-01-01&since_ticket_number=38084"

Attachments

    Outcomes