Getting Traffic Usage Information

The get_traffic is used to retrieve information about the traffic spent by a subscription between two dates. The resulting information got for each subscription lists all days between the specified dates and shows the daily traffic spent within a subscription 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 subscriptions includes the get_traffic operation node:

<packet>
<webspace>
   <get_traffic>
   ...
   </get_traffic>
</webspace>
</packet>

 

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

 

If the packet is missing both nodes since_date and to_date, the response packet will show the traffic of the specified subscription 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:

 

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

 

Samples

This packet requests traffic on a single subscriptions:

<packet>
<webspace>
<get_traffic>
   <filter>
      <id>1</id>
         </filter>
   <since_date>2006-10-01</since_date>
</get_traffic>
</webspace>
</packet>

Response:

<?xml version="1.0" encoding="UTF-8"?>
<packet version="1.6.7.0">
  <webspace>
    <get_traffic>
      <result>
        <status>ok</status>
        <filter-id>1</filter-id>
        <id>1</id>
        <traffic>
          <date>2015-10-05</date>
          <http_in>0</http_in>
          <http_out>0</http_out>
          <ftp_in>0</ftp_in>
          <ftp_out>0</ftp_out>
          <smtp_in>3055</smtp_in>
          <smtp_out>0</smtp_out>
          <pop3_imap_in>0</pop3_imap_in>
          <pop3_imap_out>0</pop3_imap_out>
        </traffic>
      </result>
    </get_traffic>
  </webspace>
</packet>

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

<packet>
<webspace>
<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>
</webspace>
</packet>

To get traffic information for all subscriptions belonging to a certain customer, use group filtering (see topic Available Filters for details). Customers whose domains are filtered can be specified within one filter either by owner-id or by owner-login.

<packet>
<webspace>
<get_traffic>
   <filter>
      <owner-login>technolux</owner-login>
      <owner-login>technologic</owner-login>
   </filter>
   <since_date>2006-10-01</since_date>
</get_traffic>
<get_traffic>
   <filter>
      <owner-login>1342</owner-login>
      <owner-login>1452</owner-login>
   </filter>
   <since_date>2006-10-01</since_date>
</get_traffic>
</webspace>
</packet>

To get traffic information for all subscriptions available for ARI RPC requester in Plesk, send the following packet:

<packet>
<webspace>
<get_traffic>
   <filter/>
   <since_date>2006-10-01</since_date>
</get_traffic>
</webspace>
</packet>