This API enables you to add a cost model with the specified name and description. Optionally, you can also set a currency for this cost model.
The syntax for calling this method is:
POST <Base_Url>/costModel
A sample API call is as follows:
POST https://123.123.123.123/vCenter-CB/api/costModel
You must have a role with Create privilege on the cost model.
The request XML for this API contains the parameters described in the following table.
XPath |
Type |
Min Occurs |
Max occurs |
Description |
---|---|---|---|---|
CostModels/CostModel |
1 |
1 |
Represents the cost model that you want to add. |
|
CostModels/CostModel/Name |
xs:string |
1 |
1 |
Name of the cost model that you want to add. The cost |
CostModels/CostModel/Description |
xs:string |
0 |
1 |
An optional description of the cost model. The description must not exceed |
CostModels/CostModel/Currency/@id |
xs:int |
0 |
1 |
ID of the currency to be set for this cost model. If not specified, the currency ID will automatically be set to USD or the global currency ID that was set during vCenter Chargeback Manager upgrade. This is an optional parameter. For more information on the currency IDs, see Appendix. |
A sample request XML is provided here.
If the operation is successful, the API returns an XML that provides the following details of the new cost model.
XPath |
Type |
Min Occurs |
Max occurs |
Description |
---|---|---|---|---|
CostModels/CostModel |
1 |
1 |
Represents the cost model that is added. |
|
CostModels/CostModel/@Id |
xs:int |
1 |
1 |
ID of the cost model that is added. |
CostModels/CostModel/Name |
xs:string |
1 |
1 |
Name of the cost model that is added. |
CostModels/CostModel/Description |
xs:string |
1 |
1 |
An optional description of the cost model. |
CostModels/CostModel/Currency |
1 |
1 |
Represents the currency set for this cost model. |
|
CostModels/CostModel/Currency/@id |
xs:int |
1 |
1 |
ID of the currency set for this cost model. |
CostModels/CostModel/Currency/Name |
xs:string |
1 |
1 |
Name of the currency set for this cost model. |
A sample response is provided here.
The following table explains the error codes displayed by the API.
Error Code |
Description |
VCB_ERR_INVALID_COST_MODEL_NAME |
Cost model name is not unique, not specified, or contains more than 255 characters. |
VCB_ERR_INVALID_COST_MODEL_DESCRIPTION |
Cost model description contains more than 512 characters. |
VCB_ERR_INVALID_CURRENCY |
Currency ID specified in the request XML is not supported. |