Getting Traffic Usage Information

The get_traffic is used to retrieve information about the traffic spent by a site between two dates. The resulting information got for each sites lists all days between the specified dates and shows the daily traffic spent within a site during this day.

In this chapter:

Request Packet Structure

Response Packet Structure

Samples

 

Request Packet Structure

A request XML packet getting traffic information for the specified sites includes the get_traffic operation node:

<packet>
<site>
   <get_traffic>
   ...
   </get_traffic>
</site>
</packet>

 

The get_traffic node does not have a separate data type, it is nested within the complex type (site.xsd). The get_traffic node has the following graphics representation:

site-get_traffic-rps.gif

 

If the packet is missing both nodes since_date and to_date, the response packet will show the traffic of the specified site day by day since its creation and up to the date of the request execution.

Important: When creating request packets, put nodes and elements in the order they follow in the packet structure.

 

Response Packet Structure

The get_traffic node of the response packet is structured as follows:

site-get_traffic-rps.gif

 

The traffic node is defined by type trafficType (plesk_domain.xsd). It is structured as follows:

site-get_traffic-reps-traffic.gif

 

Samples

A packet that requests traffic on sites with IDs 1234 and 1235 looks as follows:

<packet version="1.6.3.0">
<site>
<get_traffic>
   <filter>
      <id>1234</id>
      <id>1235</id>
   </filter>
   <since_date>2006-10-01</since_date>
</get_traffic>
<get_traffic>
   <filter>
      <name>technolux.co.uk</name>
      <name>softlux.com</name>
   </filter>
   <since_date>2006-10-01</since_date>
</get_traffic>
</site>
</packet>

Response:

<packet version="1.6.3.0">
  <site>
    <get_traffic>
      <result>
        <status>ok</status>
        <filter-id>19</filter-id>
        <id>19</id>
      <traffic>
          <date>2005-12-12</date>
          <http_in>4371212365846</http_in>
          <http_out>1234111122</http_out>
          <ftp_in>4121253</ftp_in>
          <ftp_out>163553</ftp_out>
          <smtp_in>123535</smpt_in>
          <smtp_out>341156</smtp_out>
          <pop3_imap_in>1545682</pop3_imap_in>
          <pop3_imap_out>15434674</pop3_imap_out>
      </traffic>
      </result>
    </get_traffic>
  </site>
</packet>