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

Note

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

Note: The interactive schema navigator for all request packets is available here: http://plesk.github.io/api-schemas/1.6.8.0/agent_input.svg.

  • filter, required

    It specifies sites whose traffic information will be got from Plesk. Data type: siteFilterType (site.xsd). To see the structure of this node, proceed to topic Available Filters.

  • since_date, optional

    It specifies the starting date of the period. If the packet is missing this node, the analyzed days will not be limited below. Data type: date. Format: YYYY-MM-DD.

  • to_date, optional

    It specifies the end date of the period. If the packet is missing this element, the period will be limited by the date of the request execution. Data type: date. Format: YYYY-MM-DD.

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

Note: The interactive schema navigator for all response packets is available here: http://plesk.github.io/api-schemas/1.6.8.0/agent_output.svg.

  • result, optional

    It wraps the result of the requested get_traffic operation. It can be missing if some error occurs before the validation starts. Data type: resultFilterType (common.xsd).

  • status, required

    It returns the execution status of the get_traffic operation. Data type: string. Allowed values: ok | error.

  • errcode, optional

    It is used to return an error code if the get_traffic operation fails. Data type: unsignedInt.

  • errtext, optional

    Can be used to return an error message if the get_traffic operation fails. Data type: string.

  • filter-id, optional

    It is always present and used to return the parameter by which the site was filtered by in the request packet. Data type: anySimple.

  • id, optional

    Returns the identifier of the site whose traffic is requested. It is missing if the request packet fails before the validation on the server side. Data type: integer.

  • traffic, optional

    It contains a collection of traffic data obtained from Plesk server (see below). Data type: trafficType (plesk_domain.xsd).

 

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

site-get_traffic-reps-traffic.gif

  • The date, required

    It specifies the date for which the traffic is shown. Data type: date. Format: YYYY-MM-DD.

  • The http_in, required

    It shows the incoming traffic (in bytes) got via HTTP protocol. Data type: integer.

  • The http_out, required

    It shows the outgoing HTTP traffic (in bytes). Data type: integer.

  • The ftp_in, required

    It shows the incoming traffic (in bytes) got via FTP protocol. Data type: integer.

  • The ftp_out, required

    It shows the outgoing FTP traffic (in bytes). Data type: integer.

  • The smtp_in, required

    It shows the incoming traffic (in bytes) got via SMTP protocol. Data type: integer.

  • The smtp_out, required

    It shows the outgoing SMTP traffic (in bytes). Data type: integer.

  • The pop3_imap_in, required

    It shows the incoming traffic (in bytes) got via POP3 and IMAP protocols. Data type: integer.

  • The pop3_imap_out, required

    It shows the outgoing POP3/IMAP traffic (in bytes). Data type: integer.

 

Leave your feedback on this topic here

If you have questions or need support, please visit the Plesk forum or contact your hosting provider.
The comments below are for feedback on the documentation only. No timely answers or help will be provided.