Apply Cost Template

This API enables you to apply a specified cost template to an entity in a cost model for a given time period.

Syntax

The syntax for calling this method is:

PUT <Base_Url>/costModel/{costModelId}/costTemplate

A sample API call is as follows:

PUT https://123.123.123.123/vCenter-CB/api/costModel/9/costTemplate

User Privilege

To call this API, you should have the Hierarchy Read privilege, the Entity Cost Management privilege, the Cost Model Read privilege and the Cost Template Read privilege on the system.

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 period for which the cost template is to be applied. 1232562600000
endTime Long Optional End time (in milliseconds; from January 1, 1970 GMT 00:00) of the period for which the cost template is to be applied. If specified, this parameter must be specified after the start-time. If this parameter is not specified, the cost template will be applied from the start time without an end time. 1232649000000

hierarchyId

Integer

Required

Chargeback hierarchy on whose entity the cost template is to be applied.

 

entityId

Integer

Required

Chargeback entity on which the cost template is to be applied.        

 

costTemplateId

Integer

Required

Cost template that will be applied to the entity. 

 

API Response

The API returns a response XML that provides the status of the operation.

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_COST_MODEL_ID

Cost model ID is invalid.

VCB_ERR_INVALID_COST_TEMPLATE_ID

Cost template 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.