This API enables you to modify the fixed costs for a specific entity in a cost model for a given period. Note that the fixed costs must have the same currency as the selected cost model.
This API can be used to add or delete a fixed cost on the entity based on the ‘action’ attribute of the fixed cost in the request XML. The ‘action’ attribute can be either ‘add’ or ‘delete’. To modify a fixed cost, the user should set the ‘action’ attribute to ‘add’. Fixed cost ‘id’ is mandatory for all fixed costs specified in the request XML. An entity cannot have two fixed costs with the same ID or the same name for the same time period.
The syntax for calling this method is:
PUT <Base_Url>/costModel/{costModelId}/fixedCosts
A sample API call is as follows:
PUT https://123.123.123.123/vCenter-CB/api/costModel/9/fixedCosts
Read privilege on hierarchy and cost model and Entity Cost Modify privilege on the entity.
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 fixed costs are to be modified. | 1232562600000 |
endTime | Long | Optional | End time (in milliseconds; from January 1, 1970 GMT 00:00) of the time period for which the fixed costs are to be modified. If this is not specified, the API modifies all the fixed costs specified in the request XML. This parameter must be specified as later than the start time. | 1232649000000 |
hierarchyId |
Integer | Required | ID of the Chargeback hierarchy on whose entity these fixed costs are to be modified. |
10 |
entityId |
Integer | Required | ID of the Chargeback entity on which fixed costs are to be modified. | 5 |
This API takes an XML that captures the following information.
XPath |
Type |
Min Occurs |
Max Occurs |
Description |
---|---|---|---|---|
FixedCosts/FixedCost |
1 |
unbounded |
Represents the fixed cost. |
|
FixedCosts/FixedCost/@id |
xs:int |
1 |
1 |
ID of the fixed cost. Needs to be specified only for a global fixed cost. |
FixedCosts/FixedCost/@action |
xs:string |
1 |
1 |
Specify whether you want to add or delete a fixed cost on an entity. The supported values are add and delete. If a value is not specified for this parameter, this fixed cost will be ignored. |
FixedCosts/FixedCost/Propagate |
xs:boolean |
0 |
1 |
Indicates if the fixed cost is to be propagated to the child entities. Applicable values are true and false. If the value is false, the fixed cost is applied only on the entity. If the value is true, the fixed cost is applied on the descendents of the entity. By default, the fixed cost is applied only on the immediate children. |
FixedCosts/FixedCost/Depth |
xs:int |
0 |
1 |
Specifies how deep in the tree fixed cost should be propagated. Default value is 1. For example, if a fixed cost with depth 2 is applied on a folder, only its children and grand children will be applied with this fixed cost. 0 indicates any depth. |
FixedCosts/FixedCost/EntityTypeIdFilter |
xs:int |
0 |
1 |
Specifies the filter on entity type for which propagated fixed cost should be applied. Default value is -1. For example, if you apply a propagated fixed cost at a hierarchy level and choose entity type id as 0, then the fixed cost will be applied only on the virtual machines in the hierarchy. -1 signifies any entity type.. |
A sample request XML is provided here.
The API returns an XML that indicates the status of the operation.
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_ID |
Cost model ID is invalid. |
VCB_ERR_INVALID_FIXED_COST_ID |
Fixed cost ID is invalid. |
VCB_ERR_INVALID_HIERARCHY_ID |
Hierarchy ID is invalid. |
VCB_ERR_INVALID_ENTITY_ID |
Entity ID is invalid. |
VCB_ERR_INVALID_TIME_PERIOD |
Start date is not specified or is specified as later than the end date. |
VCB_ERR_INVALID_CURRENCY |
Cost model currency does not match with any fixed cost currency. |