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.
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:
It specifies subscriptions whose traffic information will be got from Plesk. Data type: DomainFilterType (domain_input.xsd
). To see the structure of this node, proceed to topic Available Filters.
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.
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 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.
The get_traffic node of the response packet is structured as follows:
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
).
It returns the execution status of the get_traffic operation. Data type: string. Allowed values: ok | error.
It is used to return an error code if the get_traffic operation fails. Data type: unsignedInt.
Can be used to return an error message if the get_traffic operation fails. Data type: string.
It is always present and used to return the parameter by which the subscription was filtered by in the request packet. Data type: anySimple.
Returns the identifier of the subscription whose traffic is requested. It is missing if the request packet fails before the validation on the server side. Data type: integer.
It contains a collection of traffic data obtained from Plesk server (see below). Data type: trafficType (plesk_domain.xsd
).
The traffic, defined by type trafficType (plesk_domain.xsd
). It is structured as follows:
It specifies the date for which the traffic is shown. Data type: date. Format: YYYY-MM-DD.
It shows the incoming traffic (in bytes) got via HTTP protocol. Data type: integer.
It shows the outgoing HTTP traffic (in bytes). Data type: integer.
It shows the incoming traffic (in bytes) got via FTP protocol. Data type: integer.
It shows the outgoing FTP traffic (in bytes). Data type: integer.
It shows the incoming traffic (in bytes) got via SMTP protocol. Data type: integer.
It shows the outgoing SMTP traffic (in bytes). Data type: integer.
It shows the incoming traffic (in bytes) got via POP3 and IMAP protocols. Data type: integer.
It shows the outgoing POP3/IMAP traffic (in bytes). Data type: integer.
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>