Generate Report

Given the details about the hierarchy, entity, resource counters and cost model, this API sends a request for a report, which is queued as a task.


User Privilege

You should have create privilege on report and read privilege hierarchy and entities on which you want to generate the report. You must also have read privilege on the cost model and fixed costs.

Syntax

The syntax for calling this method is:

POST /<Base_Url>/report

For example, POST https://123.123.123.123/vCenter-CB/api/report

Request Parameters

The API takes a request XML that contains the following information.

XPath

Type

Min Occurs

Max occurs

Description

Reports/Report/MetaData

 

1

1

Represents the report meta data.

Reports/Report/MetaData/Name

xs:string

1

1

Name of the report that you want to generate. The report name must not exceed 255 characters.

Reports/Report/MetaData/Description

xs:string

0

1

An optional description of the report. The description must not exceed 512 characters.

Reports/Report/MetaData/ReportType

xs:string

1

1

Type of report that you want to generate. The valid report types are COST_REPORT, COST_COMPARISON_REPORT and UTILIZATION_REPORT.

Reports/Report/MetaData/ReportPeriod

 

1

1

Represents the billing period for which the report is to be generated.

Reports/Report/MetaData/ReportPeriod/From

xs:long

1

1

The start time (in milliseconds; from January 1, 1970 GMT 00:00) of the billing period for which the report is to be generated.

Reports/Report/MetaData/ReportPeriod/To

xs:long

1

1

The end time (in milliseconds; from January 1, 1970 GMT 00:00) of the billing period for which the report is to be generated.

Reports/Report/MetaData/OwnedByName

xs:string

0

1

Name of the user who owns this report.

Reports/Report/MetaData/Hierarchies/Hierarchy

 

1

1

Represents the hierarchy for which you want to generate the report.

Reports/Report/MetaData/Hierarchies/Hierarchy/@id

xs:int

1

1

ID of the hierarchy for which you want to generate the report.

Reports/Report/MetaData/Hierarchies/Hierarchy/Entities/Entity

 

1

unbounded

Represents the entity for which you want to generate the report.

Reports/Report/MetaData/Hierarchies/Hierarchy/Entities/Entity/@id

xs:int

1

1

ID of the entity for which you want to generate the report.

Reports/Report/MetaData/Hierarchies/Hierarchy/Entities/Entity/@costModelId

xs:int

1

1

ID of the cost model. This element is used for all reports except the Cost Comparison report.

Reports/Report/MetaData/Hierarchies/Hierarchy/Entities/Entity/Attributes

 

0

1

Represents a complex expression based on custom attribute value pairs that is used to filter entities in the sub-tree under “Entity”.

Reports/Report/MetaData/Hierarchies/Hierarchy/Entities/Entity/Attributes/@operator

xs:string

0

1

Represents operator for the attribute criteria expression. [enum {“OR”, “AND”} ].

Reports/Report/MetaData/Hierarchies/Hierarchy/Entities/Entity/Attributes/Attribute

 

0

unbounded

Represents simple expression using a single attribute value pair.

Reports/Report/MetaData/Hierarchies/Hierarchy/Entities/Entity/Attributes/Attribute/@id

xs:int

1

1

ID of the custom attribute.

Reports/Report/MetaData/Hierarchies/Hierarchy/Entities/Entity/Attributes/Attribute/@criteria

xs:string

0

1

Represents value matching criteria for the attribute value. [enum: { "EQUALS", "STARTS_WITH, ENDS_WITH", "CONTAINS"}].

Reports/Report/MetaData/Hierarchies/Hierarchy/Entities/Entity/Attributes/Attribute/Value

 

1

1

Represents the value of the attribute in the attribute value pair.

Reports/Report/MetaData/Hierarchies/Hierarchy/Entities/Entity/Attributes/Attributes

 

0

unbounded

Attributes can be nested within attributes for complex expression.

Reports/Report/MetaData/CostModels/CostModel

 

0

2

Represents the cost model for which you want to generate the report. This element needs to be used only for the Cost Comparison report.

Reports/Report/MetaData/CostModels/CostModel/@id

xs:int

1

1

ID of the cost model for which you want to generate the report.

Reports/Report/MetaData/ComputingResources/ComputingResource

 

1

unbounded

Represents the computing resource for which you want to generate the report.

Reports/Report/MetaData/ComputingResources/ComputingResource/@id

xs:int

1

1

ID of the computing resource for which you want to generate the report.

Reports/Report/Configuration

xs:complextype

0

1

Elements of this section are used in the vCenter Chargeback Manager UI to customize the look and feel of the report.

Reports/Report/Configuration/Computation

 

0

1

Represents a complex expression that affects the computation logic of the report.

Reports/Report/Configuration/Computation/Settings

 

0

unbounded

Every occurrence of the "Settings" element represents the configuration information for a feature.

Reports/Report/Configuration/Computation/Settings/@type

xs:string

1

1

Type of the setting. The value currently supported is "costVariance".

Reports/Report/Configuration/Computation/Settings/Property

 

1

unbounded

Property element that holds the property name and its value.

Reports/Report/Configuration/Computation/Settings/Property/@name

xs:string

1

1

Represents the name of the property.

Reports/Report/Configuration/Computation/Settings/Property/@value

xs:string

1

1

Represents the value of the property. Following are the valid properties for “costVariance”:

  • Name = enabled Values = true/false
  • Name = granularity Values = DAILY/HOURLY

Sample request XMLs are listed here:

API Response

The API returns an XML that provides details about the queued report.

XPath

Type

Min Occurs

Max occurs

Description

QueuedTasks/QueuedTask

 

1

1

Represents the queued tasks.

QueuedTasks/QueuedTask/@id

xs:int

1

1

ID of the queued task.

QueuedTasks/QueuedTask/@type

xs:string

1

1

Type of the task. For example, GENERATE_REPORT.

QueuedTasks/QueuedTask/Status

xs:string

1

1

Status of the operation. Valid values are QUEUED, READY, IN_PROGRESS, COMPLETED, ERROR.

QueuedTasks/QueuedTask/Progress

xs:double

1

1

Progress of the operation in percentage.

QueuedTasks/QueuedTask/CreatedOn

xs:long

1

1

The time when the task was created.

QueuedTasks/QueuedTask/ModifiedOn

xs:long

1

1

Date on which the queued request was last modified.

QueuedTasks/QueuedTask/Result/

 

1

1

Represents the result of the queued task.

QueuedTasks/QueuedTask/Result/Report

 

1

1

Represents the report that is being generated.

QueuedTasks/QueuedTask/Result/Report/@id

xs:int

1

1

ID of the report that is being generated.

QueuedTasks/QueuedTask/Result/Hierarchy

 

1

1

Represents the hierarchy for which the report is being generated.

QueuedTasks/QueuedTask/Result/Hierarchy/@id

xs:int

1

1

ID of the hierarchy for which the report is being generated.

QueuedTasks/QueuedTask/Result/Hierarchy/Name

xs:string

1

1

Name of the hierarchy for which the report is being generated.

QueuedTasks/QueuedTask/Errors/

xs:int

0

unbounded

Provides details of any error in processing the request.

QueuedTasks/QueuedTask/Errors/Error/@majorErrorCode

xs:int

1

1

The class of the error. It represents the HTTP Status codes.

QueuedTasks/QueuedTask/Errors/Error/@minorErrorCode

xs:int

1

1

The API error code. For example, it can indicate that the connection to the database failed.

QueuedTasks/QueuedTask/Errors/Error/@message

xs:string

1

1

A one-line, human-readable message that describes the error that occurred.

Sample response XMLs are listed here:

Error Response

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

Error code

Description

VCB_ERR_REP_GENERATE_START

Could not start report generation.

VCB_ERR_REP_INPUT_INVALID_MD_RP_NOW_END_DATE   

The end date specified in the request XML for Generate Report API is not valid.

VCB_ERR_REP_INPUT_INVALID_MD_RP_NOW_GREATER_START_DATE        

The start date specified is later than the end date in the request XML for Generate Report API.

VCB_ERR_REP_INPUT_INVALID_MD_RP_NOW_START_DATE                

The start date is empty or invalid in the request XML for Generate Report API.

VCB_ERR_REP_INPUT_INVALID_HIERARCHY_ENTITY_ID

The hierarchy entity ID specified for the report or the report schedule is invalid.

VCB_ERR_REP_INPUT_INVALID_HIERARCHY_ID

The hierarchy ID specified for the report or the report schedule is invalid.

VCB_ERR_REP_INPUT_COST_MODEL

The cost model specified for the report or the report schedule is invalid.

VCB_ERR_REP_INPUT_ENTITY

This error code is not used currently.

VCB_ERR_REP_INPUT_INVALID_DUPLICATE_COST_MODEL

You have specified duplicate cost models while generating the Cost Comparison report.

VCB_ERR_REP_INPUT_INVALID_COST_MODELS_WITH_NON_UNIQUE_CURRENCY

Cost models selected while generating or scheduling a report do not have the same currency.

VCB_ERR_REP_INPUT_HIERARCHY                                 

Hierarchy specified in the request XML for Generate Report API or Schedule Report API is invalid.

VCB_ERR_REP_RUNTIME_GENERATE

Could not fill data in the the report.