Accounts-accountId-products-productId-usage:GET

From Hostway API Documentation
Revision as of 11:25, 26 March 2013 by Mike.robski (Talk | contribs)
Jump to: navigation, search

GET /accounts/{accountId}/products/{productId}/usage?from={fromDate}&to={toDate}

Get an aggregated services usage report of a product

Products that currently generate usage data:

FlexCloud Server
Exchange 2010 Mailbox Archiving
Exchange 2010 E-mail Encryption

Contents


Request

GET /accounts/{accountId}/products/{productId}/usage?from={fromDate}&to={toDate}

Request Parameters

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

URI Parameters

fromDate - string - required
Start date of the usage report. Should be in YYYY-MM-DD format. The usage returned includes usage with dates from fromDate 00:00:00 UTC. fromDate must be older or equal to toDate.
toDate - string - required
Start date of the usage report. Should be in YYYY-MM-DD format. The usage returned includes usage with dates to toDate 23:59:59 UTC. toDate must be older than today's date in UTC.

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:
- fromDate or toDate URI parameter is missing;
- toDate is older than fromDate;
- today is older than or equal to toDate or fromDate;
403 Forbidden
Forbidden access to regular accounts. Only Sales Agents have access to an usage resource.
404 Not Found
The account Id or product Id was not found.

Response Body

{
 "list" : [
 {
    "instance" : {instanceName},
    "amount" : {amount},
    "type" : {usageType},
    "unit" : {usageUnit}
  } ,..., 
  {
    "instance" : {instanceName},
    "amount" : {amount},
    "type" : {usageType},
    "unit" : {usageUnit}
  } ],
  "links" : [ {
    "href" : "{{APIBaseURL}}/accounts/smith182278/products/smith182278-0000013534cbbc0dc7182cea000aa37f798db0/usage?from=2012-01-01&to=2012-12-31",
    "rel" : "self"
  } ]
}
 

Parameters

list - list
a list of all services usage records. Each record consists of:
instanceName - string
name of a service instance
usageType - string
type of a resource used
amount - integer
used resouce amount
unit - string
measurement unit of the resource used
links - list
Hypermedia for this resource. Links to self.

Usage Types

Usage types under monitoring are the following:

Type Unit Description
ipaddress hour Flexible IP address uptime
loadbalancer hour Load Balancer uptime
vm hour Virtual Machine uptime
vm.app.office.2007.pro hour Virtual Machine uptime for Office 2007 Professional
vm.app.office.2007.std hour Virtual Machine uptime for Office 2007 Standard
vm.app.plesk hour Virtual Machine uptime for Plesk Control Panel
vm.app.plesk.domain100 hour Virtual Machine uptime for 100 Plesk domains
vm.app.plesk.powerpack hour Virtual Machine uptime for Plesk Powerpack
vm.app.plesk.powerpack hour Virtual Machine uptime for Plesk Powerpack
vm.app.sqlserver.std hour Virtual Machine uptime for SQL Server Standard Edition
vm.app.sqlserver.web hour Virtual Machine uptime for SQL Server Web Edition
vm.app.terminalservices.cal hour Virtual Machine uptime for 1 TS CAL
vm.cpu hour Virtual Machine CPU uptime
vm.disk.10gb hour Virtual Machine uptime for 10GB Disk Space
vm.memory.1gb hour Virtual Machine uptime for 1GB of Memory
vm.monitoring.port hour Virtual Machine uptime for Port Monitoring
vm.monitoring.url hour Virtual Machine uptime for URL Monitoring
vm.os.redhat hour Virtual Machine uptime for RedHat OS
vm.traffic.in mb Virtual Machine Incoming Traffic
vm.traffic.out mb Virtual Machine Outgoing Traffic
vm.traffic.total mb Virtual Machine Total Traffic
volume.disk.10gb hour Storage Volume uptime for 10GB of Space
vpn hour VPN uptime
vpn.remote5 hour VPN uptime for 5 remote points
vpn.sitetosite hour VPN uptime for site-to-site access

Examples

GET call

Request

GET {{APIBaseURL}}/accounts/smith182278/products/smith182278-0000013534cbbc0dc7182cea000aa37f798db0/usage?from=2012-01-01&to=2012-12-31

Response

HTTP/1.1 200 OK

{
  "list" : [ {
    "instance" : "smith182278-Test-VM.1",
    "amount" : 24,
    "type" : "vm.disk.10gb",
    "unit" : "hour"
  }, {
    "instance" : "smith182278-Test-VM.0",
    "amount" : 24,
    "type" : "vm.disk.10gb",
    "unit" : "hour"
  }, {
    "instance" : "smith182278-Test-VM.3",
    "amount" : 24,
    "type" : "vm.disk.10gb",
    "unit" : "hour"
  }, {
    "instance" : "smith182278-Test-VM.2",
    "amount" : 24,
    "type" : "vm.disk.10gb",
    "unit" : "hour"
  }, {
    "instance" : "smith182278-Test-VM.4",
    "amount" : 24,
    "type" : "vm.disk.10gb",
    "unit" : "hour"
  }, {
    "instance" : "smith182278-Test-VM.1",
    "amount" : 24,
    "type" : "vm.memory.1gb",
    "unit" : "hour"
  }, {
    "instance" : "smith182278-Test-VM.0",
    "amount" : 24,
    "type" : "vm.memory.1gb",
    "unit" : "hour"
  }, {
    "instance" : "smith182278-Test-VM.3",
    "amount" : 24,
    "type" : "vm.memory.1gb",
    "unit" : "hour"
  }, {
    "instance" : "smith182278-Test-VM.2",
    "amount" : 24,
    "type" : "vm.memory.1gb",
    "unit" : "hour"
  }, {
    "instance" : "smith182278-Test-VM.5",
    "amount" : 24,
    "type" : "vm.memory.1gb",
    "unit" : "hour"
  }, {
    "instance" : "smith182278-Test-VM.4",
    "amount" : 24,
    "type" : "vm.memory.1gb",
    "unit" : "hour"
  }, {
    "instance" : "smith182278-Test-VM.7",
    "amount" : 24,
    "type" : "vm.memory.1gb",
    "unit" : "hour"
  }, {
    "instance" : "smith182278-Test-VM.6",
    "amount" : 24,
    "type" : "vm.memory.1gb",
    "unit" : "hour"
  }, {
    "instance" : "",
    "amount" : 6488,
    "type" : "vm.traffic.total",
    "unit" : "mb"
  }, {
    "instance" : "smith182278-Test-VM",
    "amount" : 354,
    "type" : "vm.traffic.in",
    "unit" : "mb"
  }, {
    "instance" : "smith182278-Test-VM",
    "amount" : 24,
    "type" : "vm.app.plesk",
    "unit" : "hour"
  }, {
    "instance" : "smith182278-Test-VM.1",
    "amount" : 24,
    "type" : "vm.cpu",
    "unit" : "hour"
  }, {
    "instance" : "smith182278-Test-VM.0",
    "amount" : 24,
    "type" : "vm.cpu",
    "unit" : "hour"
  }, {
    "instance" : "smith182278-Test-VM.3",
    "amount" : 24,
    "type" : "vm.cpu",
    "unit" : "hour"
  }, {
    "instance" : "smith182278-Test-VM.2",
    "amount" : 24,
    "type" : "vm.cpu",
    "unit" : "hour"
  }, {
    "instance" : "smith182278-Test-VM",
    "amount" : 24,
    "type" : "vm",
    "unit" : "hour"
  }, {
    "instance" : "smith182278-Test-VM",
    "amount" : 6134,
    "type" : "vm.traffic.out",
    "unit" : "mb"
  } ],
  "links" : [ {
    "href" : "{{APIBaseURL}}/accounts/smith182278/products/smith182278-0000013534cbbc0dc7182cea000aa37f798db0/usage?from=2012-01-01&to=2012-12-31",
    "rel" : "self"
  } ]
}
 

See also


blog comments powered by Disqus

Personal tools
Namespaces
Variants
Actions
APIs
Navigation
Toolbox