Accounts-accountId-products-productId-bandwidth-weekly:GET
From Hostway API Documentation
				
								
				Revision as of 15:56, 27 September 2013 by Mike.robski  (Talk | contribs)
				
			GET /accounts/{accountId}/products/{productId}/bandwidth/weekly?filterType={filterType}&from={filterStartDate}&to={filterEndDate}
Get a report on the weekly 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/weekly?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 each bandwidth type; they will not be summed for each week.
 
- 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 weeks 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 weeks after filterStartDate
 
 
- 403 Forbidden
 - Forbidden access to the account.
 
- 404 Not Found
 - The account Id or product Id was not found.
 
Response Body
{
 "list" : [
 { 
      "week": {weekNumber},
      "year": {yearNumber},
      "type": {trafficType},
      "domain": {domainName},
      "bytes": {numberOfBytes}
  } ,..., 
  { 
      "week": {weekNumber},
      "year": {yearNumber},
      "type": {trafficType},
      "domain": {domainName},
      "bytes": {numberOfBytes}
  } ],
  "links" : [ {
    "href" : "{{APIBaseURL}}/accounts/smith182278/products/smith182278-0000013534cbbc0dc7182cea000aa37f798db0/bandwidth/weekly?from=2012-01-01&to=2012-12-31",
    "rel" : "self"
  } ]
}
 
Parameters
- list - list
 - a list of all bandwidth usage records. Each record consists of:
 
-  week - integer
- the week of the year for which the bandwidth is collected. This is a number from 1 to 52 or 53. "Week 1" is whichever week contains the date of January 4 of that year, starting with Monday and ending with Sunday. Any dates within the year that precede this week are considered to be within the last week of the previous year.
 
 
-  year - 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
 
 
-  bytes - 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/weekly?filterType=www&from=2012-06-03&to=2012-06-24
Response
HTTP/1.1 200 OK
{
  "list" : [ {
      "week": 23,
      "year": 2013
      "type": "www",
      "domain": "smithwidgets.com",
      "bytes": 12345678
  }, {
     "week": 24,
     "year": 2013
     "type": "www",
     "domain": "smithwidgets.com" ,
     "bytes": 1048576
  }, {
    "week" : 25,
    "year": 2013
    "type" : "www",
    "domain" : "smithwidgets.com",
    "bytes" : 2097152
  }],
  "links" : [ {
    "href" : "{{APIBaseURL}}/accounts/smith182278/products/smith182278-0000013534cbbc0dc7182cea000aa37f798db0/bandwidth/daily?from=2013-06-03&to=2013-06-24",
    "rel" : "self"
  } ]
}
 
See also