Accounts-accountId-products-productId-bandwidth-daily:GET
From Hostway API Documentation
GET /accounts/{accountId}/products/{productId}/bandwidth/daily?filterType={filterType}&from={filterStartDate}&to={filterEndDate}
Get a report on the daily 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/daily?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 include separate entries for the different types of bandwidth (it will not sum them up for each date).
- filterStartDate - string - required
- Start date of the bandwidth usage report. Should be in YYYY-MM-DD 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
- Start date of the bandwidth usage report. Should be in YYYY-MM-DD format. The bandwidth usage returned includes usage with 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 dates 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 is today's date or a future date;
- - filterEndDate is more than 100 days after filterStartDate
- 403 Forbidden
- Forbidden access to the account.
- 404 Not Found
- The account Id or product Id was not found.
Response Body
{ "list" : [ { "date": {dateISOFormat}, "type": {trafficType}, "domain": {domainName}, "bytes": {numberOfBytes} } ,..., { "date": {dateISOFormat}, "type": {trafficType}, "domain": {domainName}, "bytes": {numberOfBytes} } ], "links" : [ { "href" : "{{APIBaseURL}}/accounts/smith182278/products/smith182278-0000013534cbbc0dc7182cea000aa37f798db0/bandwidth/daily?from=2012-01-01&to=2012-12-31", "rel" : "self" } ] }
Parameters
- list - list
- a list of all bandwidth usage records. Each record consists of:
- dateISOFormat - string
- the date for which the bandwidth is collected
- trafficType - string
- type of the traffic(web 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/daily?filterType=www&from=2012-01-01&to=2012-01-03
Response
HTTP/1.1 200 OK { "list" : [ { "date": "2012-01-01", "type": "www", "domain": "smithwidgets.com", "bytes": 12345678 }, { "date": "2012-01-02", "type": "www", "domain": "smithwidgets.com" , "bytes": 1048576 }, { "date" : "2012-01-03", "type" : "www", "domain" : "smithwidgets.com", "bytes" : 2097152 }], "links" : [ { "href" : "{{APIBaseURL}}/accounts/smith182278/products/smith182278-0000013534cbbc0dc7182cea000aa37f798db0/bandwidth/daily?from=2012-01-02&to=2012-01-03", "rel" : "self" } ] }
See also