Add Fixed Cost

This API enables you to add a fixed cost with a name and optionally a description and a currency.

Syntax

The syntax for calling this method is:

POST <Base_Url>/fixedCost

A sample API call is as follows:

POST https://123.123.123.123/vCenter-CB/api/fixedCost

User Privilege

You must have a role with Create privilege on the fixed cost.

Request Body Parameters

This API takes an XML request that captures the following information.

XPath

Type

Min Occurs

Max Occurs

Description

FixedCosts/FixedCost

1

unbounded

Represents the fixed cost.

FixedCosts/FixedCost/Name

xs:string

1

1

Name of the fixed cost. The name must be unique and not exceed 255 characters

FixedCosts/FixedCost/Description

xs:string

0

1

An optional description for the fixed cost. The description must not exceed 512 characters.

FixedCosts/FixedCost/Currency

0

1

Represents the currency to be set for this fixed cost.

FixedCosts/FixedCost/Currency/@id

xs:int

0

1

ID of the currency to be set for this fixed cost. If not specified, the currency will be set to USD or the global currency set during vCenter Chargeback Manager upgrade.

FixedCosts/FixedCost/IsProrated

xs:boolean

0

1

Represents whether the fixed cost is prorated or not. By default fixed costs are prorated (true). Cannot be used for one-time fixed costs.

FixedCosts/FixedCost/IsPowerStateBased

xs:boolean

0

1

Represents whether power state of the virtual machine is considered while applying the fixed cost. That is, fixed cost will be applied only when the virtual machine is powered on. Default value is false. Cannot be used for one-time fixed costs.

FixedCosts/FixedCost/Type

0

1

Represents the fixed cost type.

FixedCosts/FixedCost/Type/@id

xs:int

0

1

ID of the fixed cost type. Allowed values are 0 (recurring fixed cost) and 1 (one-time fixed cost). Default value is 0.

A sample request XML is provided here.

API Response

The API returns the following details of the newly created fixed cost.

XPath

Type

Min Occurs

Max Occurs

Description

FixedCosts/FixedCost

1

unbounded

Represents the new fixed cost.

FixedCosts/FixedCost/@id

xs:int

1

1

ID of the new fixed cost.

FixedCosts/FixedCost/Name

xs:string

1

1

Name of the fixed cost. The name must not exceed 255 characters.

FixedCosts/FixedCost/Description

xs:string

1

1

An optional description for the fixed cost. The description must not exceed 512 characters.

FixedCosts/FixedCost/Currency

1

1

Represents the currency set for this fixed cost. 

FixedCosts/FixedCost/Currency/@id

xs:int

1

1

ID of the currency set for this fixed cost. 

FixedCosts/FixedCost/Currency/Name

xs:string

1

1

Name of the currency set for this fixed cost. 

FixedCosts/FixedCost/IsProrated

xs:boolean

0

1

Represents whether the fixed cost is prorated or not.

FixedCosts/FixedCost/IsPowerStateBased

xs:boolean

0

1

Represents whether power state of the virtual machine is considered while applying the fixed cost. That is, fixed cost will be applied only when the virtual machine is powered on.

FixedCosts/FixedCost/Type

1

1

Represents the fixed cost type.

FixedCosts/FixedCost/Type/@id

xs:int

1

1

ID of the fixed cost type.

FixedCosts/FixedCost/Type/Name

xs:string

1

1

Name of the fixed cost type.

FixedCosts/FixedCost/IsDeleted

xs:boolean

1

1

If true, then the fixed cost is deleted and cannot be used for further cost configurations.

A sample response is provided here.

Error Response

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

Error Code

Description

VCB_ERR_INVALID_FIXED_COST_NAME

Fixed cost name is blank, not unique or contains more than 255 characters.

VCB_ERR_INVALID_FIXED_COST_DESCRIPTION

Fixed cost description is empty or contains more than 512 characters.

VCB_ERR_INVALID_CURRENCY

The request XML specifies an invalid currency ID.