Get Base Rates

This API enables you to get base rates for the cost model for the specified time period.  If a base rate for the same computing resource has multiple values within the requested period, the response XML includes all such values, along with the corresponding time periods.

Syntax

The syntax for calling this method is:

GET <Base_Url>/costModel/{costModelId}/baseRates

A sample API call is as follows:

GET https://123.123.123.123/vCenter-CB/api/costModel/999/baseRates

User Privilege

You must have a role with Read privilege on the cost model.

URL Parameters

Name

Data Type

Required/Optional

Description

Sample Value

startTime

Long

Required

Start time (in milliseconds; from January 1, 1970 GMT 00:00) of the time period for which the base rates are to be retrieved

1232562600000

endTime

Long

Optional

End time (in milliseconds; from January 1, 1970 GMT 00:00) of the time period for which the base rates are to be retrieved.  If this is not specified, the API returns all the base rates from the specified start time. This parameter must be specified as later than the start time.

1232649000000

Request Body Parameters

This API does not need any request parameters.

API Response

The API returns an XML that provides the following details.

XPath

Type

Min Occurs

Max Occurs

Description

BaseRates/BaseRate

 

1

Unbounded

Represents the base rate information for a computing resource.

BaseRates/BaseRate/ComputingResource/@id

xs:int

1

1

The computing resource on which the base rate is applied.

BaseRates/BaseRate/ComputingResource/Name

xs:string

1

1

Name of the computing resource on which the base rate is applied.

BaseRates/BaseRate/Value

xs:double

1

n

The value of the base rate for the computing resource. Base rate value must not be less than 0 (zero).

BaseRates/BaseRate/StartTime

xs:long

1

1

The start time of the duration for which the base rate is effective.

BaseRates/BaseRate/EndTime

xs:long

1

1

The end time of the duration for which the base rate is effective. If the end time is not specified, the base rate will be effective forever.

BaseRates/BaseRate/Duration

1

1

Represents the duration of the base rate.

BaseRates/BaseRate/Duration/@id

xs:int

1

1

ID of the duration.

BaseRates/BaseRate/Duration/Name

xs:string

1

1

Name of the duration. The name indicates whether the base rate is hourly, monthly, or yearly.

BaseRates/BaseRate/Slabs/Slab

 

0

unbounded

Represents one base rate slab. This element is present only if slabbing is enabled.

BaseRates/BaseRate/Slabs/Slab/Start

xs:int

1

1

Start allocation percentage of the slab slice.

BaseRates/BaseRate/Slabs/Slab/End

xs:int

0

1

End allocation percentage of the slab slice.  If this value is not specified, the Slab rate is applicable from slab Start % of allocation to the total consumption.

BaseRates/BaseRate/Slabs/Slab/Value

xs:double

0

1

The base rate value set for the computing resource for this slab. Base rate value must not be less than 0 (zero).  For example, if Resource Consumption = 200 Units, Resource Allocation = 100 Units, Value=3.1, Start=10, End=50, Slab/Value=2.1, then for the first (100*10% = 10) units, base rate = 3.1; for (100*50%-100*10% = 40) units, base rate = 2.1; and for (200 – 100*50% = 150) units, base rate = 3.1.

A sample response is provided here.

Error Response

The following table explains the error code displayed by the API.

Error Code

Description

VCB_ERR_INVALID_COST_MODEL_ID

Cost model ID does not exist in vCenter Chargeback Manager.

VCB_ERR_INVALID_TIME_PERIOD

Start date is not specified or is specified as later than the end date.