Updating Traffic Usage Statistics

If the traffic usage is calculated on a site by statistics facilities of the Panel, this data is added to the system automatically. If this data is gathered using some external statistics means, the set_traffic operation can help manually update these data.

In this chapter:

Request Packet Structure

Response Packet Structure

Samples

 

Request Packet Structure

A request XML packet that sets traffic data for a certain site should include the set_traffic operation node:

<packet>
<webspace>
   <set_traffic>
   ...
   </set_traffic>
</webspace>
</packet>

 

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

site-set_traffic-rps.gif

  • dom_id, required

    It identifies a site whose traffic settings are set. Data type: integer.

  • date, required

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

  • smtp_in, required

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

  • smtp_out, required

    It is used to show the outgoing SMTP traffic (in bytes). Data type: integer.

  • pop3_imap_in, required

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

  • pop3_imap_out, required

    It is used to show the outgoing POP3/IMAP traffic (in bytes). Data type: integer.

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

 

Response Packet Structure

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

site-set_traffic-reps.gif

  • result, optional

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

  • status, required

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

  • errcode, optional

    Is used to return an error code when the operation fails. Data type: unsignedInt.

  • errtext, optional

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

  • id, optional

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

 

 

Samples

To set traffic information for the specified site, use the following packet:

<packet version="1.6.3.0">
<site>
<set_traffic>
   <dom_id>1134</dom_id>
   <date>2005-12-12</date>
   <smtp_in>514237124628</smtp_in>
   <smtp_out>6153462547</smtp_out>
   <pop3_imap_in>49769379</pop3_imap_in>
   <pop3_imap_out>7236487263</pop3_imap_out>
</set_traffic>
</site>
</packet>

Response:

<packet version="1.6.3.0">
  <site>
    <set_traffic>
      <result>
        <status>ok</status>
        <id>19</id>
      </result>
    </set_traffic>
  </site>
</packet>