Accounts-accountId-products-productId-bandwidth-yearly:GET

From Hostway API Documentation
Revision as of 15:56, 27 September 2013 by Mike.robski (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

GET /accounts/{accountId}/products/{productId}/bandwidth/yearly?filterType={filterType}&from={filterStartDate}&to={filterEndDate}

Get a report on the yearly bandwidth usage of the product

Each bandwidth usage is filtered by the traffic type(www, ftp), the start date and the end date in ISO format(eg. 2013-02-20)

Contents


Request

GET /accounts/{accountId}/products/{productId}/bandwidth/yearly?filterType={filterType}&from={filterStartDate}&to={filterEndDate}

Request Parameters

accountId - string
The Id of the account.
productId - string
The Id of the product.

URI Parameters

filterType(optional) - string - optional
Should be one of either www or ftp. In case the total(www + ftp) bandwidth is needed, this parameter can be omitted. If it's omitted, the response will contain separate entries for each type for each year; the values will not be summed for each year.
filterStartDate - string - required
Start date of the bandwidth usage report. Should be in YYYY-MM-DD(ISO) format. The usage returned includes usage with dates from filterStartDate 00:00:00 UTC. filterStartDate must be older or equal to filterEndDate.
filterEndDate - string - required
End date of the bandwidth usage report. Should be in YYYY-MM-DD(ISO) format. The bandwidth usage returned includes all dates to filterEndDate 23:59:59 UTC. filterEndDate must be older than today's date in UTC.
showBlanks - optional
When the showBlanks parameter is passed, the response body will include values for all years and types, even if there is no associated traffic.

Request Headers

Authorization - HTTP Authorization header [1]
The Authentication credentials of the client application.

Request Body

None

Response

Status Code

200 OK
Success.
400 Bad Request
A request is considered bad any of the following situation is available:
- filterType is not one of www, ftp;
- filterStartDate or filterEndDate URI parameter is missing;
- filterEndDate is older than filterStartDate;
- either filterEndDate or filterStartDate are today's date or a future date;
- filterEndDate is more than 100 years after filterStartDate
403 Forbidden
Forbidden access to the account.
404 Not Found
The account Id or product Id was not found.

Response Body

{
 "list" : [
 { 
      "year": {yearNumber},
      "type": {trafficType},
      "domain": {domainName},
      "bytes": {numberOfBytes}
  } ,..., 
  { 
      "year": {yearNumber}
      "type": {trafficType},
      "domain": {domainName},
      "bytes": {numberOfBytes}
  } ],
  "links" : [ {
    "href" : "{{APIBaseURL}}/accounts/smith182278/products/smith182278-0000013534cbbc0dc7182cea000aa37f798db0/bandwidth/yearly?from=2012-01-01&to=2013-12-31",
    "rel" : "self"
  } ]
}
 

Parameters

list - list
a list of all bandwidth usage records. Each record consists of:
yearNumber - integer
the year for which the bandwidth is collected
trafficType - string
type of the traffic(www or ftp)
domainName - string
the domain name, for which the bandwidth data is collected
numberOfBytes - integer
the bandiwdth calculated in bytes
links - list
Hypermedia for this resource. Links to self.

Examples

GET call

Request

GET {{APIBaseURL}}/accounts/smith182278/products/smith182278-0000013534cbbc0dc7182cea000aa37f798db0/bandwidth/yearly?filterType=www&from=2012-01-01&to=2013-12-31

Response

HTTP/1.1 200 OK

{
  "list" : [ {
      "year": 2012,
      "type": "www",
      "domain": "smithwidgets.com",
      "bytes": 12345678
  }, {
      "year": 2013,
      "type": "www",
      "domain": "smithwidgets.com",
      "bytes": 12345678
  }
],
  "links" : [ {
    "href" : "{{APIBaseURL}}/accounts/smith182278/products/smith182278-0000013534cbbc0dc7182cea000aa37f798db0/bandwidth/yearly?filterType=www&from=2012-01-01&to=2013-12-31",
    "rel" : "self"
  } ]
}
 

See also


blog comments powered by Disqus

Personal tools
Namespaces
Variants
Actions
APIs
Navigation
Toolbox