Home > Cloud Cruiser 3 > REST API reference > Budgets and alerts > Get usage for a customer

Get usage for a customer

Retrieves the budget and corresponding usage for a specified customer and accounting period.

Resource URL

POST http://<ccServerURL>/rest/v1/budgets/usage

Request

Parameters

None

Content-Type

application/xml

Body

A budget query, as XML text with the root element budgetQueryInput or JAXB type com.cloudcruiser.server.webservices.v1.dto.budgets.BudgetQueryInput.

Schema

This XML schema describes a query for a customer's budgets and usage.

<xs:element name="budgetQueryInput" type="tns:BudgetQueryInput"/>

<xs:complexType name="BudgetQueryInput">
  <xs:sequence>
    <xs:element name="customer" type="tns:Customer"/>
    <xs:element minOccurs="0" name="accountingYear" type="xs:short"/>
    <xs:element minOccurs="0" name="accountingPeriod" type="xs:short"/>
    <xs:element minOccurs="0" name="budgetType" type="tns:BudgetAlertType"/>
    <xs:element minOccurs="0" name="resource" type="tns:Resource"/>
  </xs:sequence>
</xs:complexType>
<xs:complexType name="Customer">
  <xs:attribute name="id" type="xs:int"/>
  <xs:attribute name="accountId" type="xs:string"/>
  <xs:attribute name="accountingDay" type="xs:short"/>
</xs:complexType>
<xs:complexType name="Resource">
  <xs:attribute name="headerId" type="xs:int"/>
  <xs:attribute name="resourceid" type="xs:string" use="required"/>
</xs:complexType>

Response

Content-Type

application/xml

Body

The requested budget and usage, as XML text with the root element budgetAndUsage or JAXB type com.cloudcruiser.server.webservices.v1.dto.budgets.BudgetAndUsage​.

Schema

This XML schema describes a budget and the usage against it for a particular customer during a particular period.

<xs:element name="budgetAndUsage" type="tns:BudgetAndUsage"/>

<xs:complexType name="BudgetAndUsage">
  <xs:sequence>
    <xs:element name="customer" type="tns:Customer"/>
    <xs:element name="accountingYear" type="xs:short"/>
    <xs:element name="accountingPeriod" type="xs:short"/>
    <xs:element name="accountingStartDate" type="ns1:Date"/>
    <xs:element name="accountingEndDate" type="ns1:Date"/>
    <xs:element name="standardAlertsEnabled" type="xs:boolean"/>
    <xs:element name="projectedAlertsEnabled" type="xs:boolean"/>
    <xs:element name="useDefaultThresholds" type="xs:boolean"/>
    <xs:element name="threshold1Percent" type="xs:short"/>
    <xs:element name="threshold2Percent" type="xs:short"/>
    <xs:element name="threshold3Percent" type="xs:short"/>
    <xs:element maxOccurs="unbounded" minOccurs="0" name="periodBudgetUsage">
      <xs:complexType>
        <xs:sequence>
          <xs:element name="budgetType" type="tns:BudgetAlertType"/>
          <xs:element name="valueType" type="tns:ValueType"/>
          <xs:element minOccurs="0" name="resource" type="tns:Resource"/>
          <xs:element minOccurs="0" name="currencyCode" type="xs:string"/>
          <xs:element name="periodBudgetValue" type="xs:double"/>
          <xs:element name="actualUsage" type="xs:double"/>
          <xs:element name="usagePercent" type="xs:short"/>
          <xs:element name="status" type="tns:AlertStatusType"/>
          <xs:element minOccurs="0" name="overBudgetAmount" type="xs:double"/>
          <xs:element minOccurs="0" name="underBudgetAmount" type="xs:double"/>
        </xs:sequence>
        <xs:attribute name="budgetId" type="xs:int"/>
      </xs:complexType>
    </xs:element>
  </xs:sequence>
</xs:complexType>

Example

URL invocation

POST http://localhost:8080/rest/v1/budgets/usage

Java invocation

BudgetAndUsage budgetUsage= budgetsServiceProxy.getBudgetAndUsage(queryInput);​

Request body
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<budgetQueryInput xmlns="http://www.cloudcruiser.com/webservices/v1/Budget">
  <customer accountId="B-BB"/>
  <accountingYear>2013</accountingYear>
  <accountingPeriod>10</accountingPeriod>
</budgetQueryInput>
Response body
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<budgetAndUsage xmlns="http://www.cloudcruiser.com/webservices/v1/Budget">
  <customer id="8" accountId="B-BB" accountingDay="5"/>
  <accountingYear>2013</accountingYear>
  <accountingPeriod>10</accountingPeriod>
  <accountingStartDate year="2013" month="10" day="5"/>
  <accountingEndDate year="2013" month="11" day="4"/>
  <standardAlertsEnabled>true</standardAlertsEnabled>
  <projectedAlertsEnabled>true</projectedAlertsEnabled>
  <useDefaultThresholds>true</useDefaultThresholds>
  <threshold1Percent>80</threshold1Percent>
  <threshold2Percent>100</threshold2Percent>
  <threshold3Percent>120</threshold3Percent>
  <periodBudgetUsage budgetId="5011">
    <budgetType>COST</budgetType>
    <valueType>COST</valueType>
    <currencyCode>usd</currencyCode>
    <periodBudgetValue>42500.0</periodBudgetValue>
    <actualUsage>0.0</actualUsage>
    <usagePercent>0</usagePercent>
    <status>NO_USAGE</status>
  </periodBudgetUsage>
</budgetAndUsage>
Last modified

Tags

This page has no custom tags.

Classifications

This page has no classifications.
© Copyright 2018 Hewlett Packard Enterprise Development LP