Accounts-accountId-dedicatedServers-serverId-ipAddresses-ipaddress-statistics-traffic:GET
From Hostway API Documentation
(Difference between revisions)
(→URI Parameters) |
Corinne.chui (Talk | contribs) m (1 revision) |
Latest revision as of 13:35, 30 May 2016
[edit] GET /accounts/{accountId}/dedicatedServers/{serverId}/ipAddresses/{ipAddress}/statistics/traffic
Get traffic statistics by specific time range for an IP address of a dedicated server.
Contents |
[edit] Request
GET /accounts/{accountId}/dedicatedServers/{serverId}/ipAddresses/{ipAddress}/statistics/traffic?scope={scope}&startDate={startDate}&endDate={endDate}&period={period}&method={method}
[edit] URI Parameters
- accountId - string
- (required)
- The account Id of the dedicated server owner.
- serverId
- (required)
- The dedicated server Id for the requested IP address.
- ipAddress - string
- The specific IP address.
- scope
- (required)
- The scope defines whether we want statistics for inbound or outbound traffic. Possible values: receive and transmit and total (receive plus transmit values).
- startDate
- (required)
- Start date that represents the beginning of the requested statistical time frame. The format should be yyyy-mm-dd.
- endDate
- (required)
- End date that represents the end of the requested statistical time frame. The format should be yyyy-mm-dd.
- period
- (required)
- Represents the granularity of the returned data sets for the requested time frame. Possible values: hourly or daily.
- method
- (required)
- Statistics method used. Possible values: avg,sum,min and max.
[edit] Request Headers
- Authorization - HTTP Authorization header [1]
- The Authentication credentials of the client application.
- Accept - HTTP Accept header [2]
- Possible values are application/json, text/csv. If omitted json will be returned.
[edit] Date Format
- All dates are interpreted and represented in UTC with ISO 8601 format
[edit] Response
[edit] Status Codes
- 200 OK
- Success
- 400 Bad Request
- Incorrect URI parameters.
- 401 Unauthorized
- The supplied credentials are invalid or do not provide permissions for this operation.
- 403 Forbidden
- The authorized user does not have permissions to access the resource or the requested time frame exceeds the maximum limit for the API.
- The current limit is 500 data sets per response entity, regardless of the period granularity.
- 404 Not Found
- The dedicated server or account does not exist.
[edit] Response Body
[ { "count": {count}, "date": "{date}", "values": {values} } ]
[edit] Parameters
- count - integer
- The count of traffic operations for the specified period.
- date - string
- The date time stamp for the specified period.
- values - float
- The actual traffic value represented for the specified period.
[edit] Examples
Successful response for total daily inbound traffic statistics
- GET /accounts/{accountId}/dedicatedServers/{serverId}/ipAddresses/{ipAddress}/statistics/traffic?scope=receive&startDate=2015-05-05&endDate=2012-05-07&period=daily&method=sum
Response Code:
HTTP/1.1 200 OK
Response Body:
[ { "count": 143, "date": "2015-05-05 00:00:00", "values": 344130.30069930002 }, { "count": 144, "date": "2015-05-07 00:00:00", "values": 658.34027777777999 }, ]
Failure while trying to get traffic statistics and the number of returned data sets exceeds the maximum limit
- GET /accounts/{accountId}/dedicatedServers/{serverId}/ipAddresses/{ipAddress}/statistics/traffic?scope=receive&startDate=2015-01-01&endDate=2015-05-05&period=daily&method=sum
Response Code:
HTTP/1.1 403 Forbidden
Response Body:
{ "overLimit": { "message": "GET data error", "code": 403, "details": "The (startDate, endDate) range is too large. Maximum number of returned data sets exceeded." } }
Failure while trying to get traffic statistics and the start date is before the create date (2015-01-01) of the dedicated server
- GET /accounts/{accountId}/dedicatedServers/{serverId}/ipAddresses/{ipAddress}/statistics/traffic?scope=receive&startDate=2011-01-01&endDate=2015-05-05&period=daily&method=sum
Response Code:
HTTP/1.1 400 Bad Request
Response Body:
{ "badRequest": { "message": "GET data error", "code": 400, "details": { "startDate": "2011-01-01 is less than minimum value 2015-01-01" } } }