Methods for working with reports
Using the Integration Server REST API, you can perform the following actions when working with tenant protection reports:
- Generate a report
- Upload a report
Report generation
Allows you to generate a report based on data saved to the Integration Server database, taking into account the specified report settings. You can specify the tenant about whose protection you want to generate a report, as well as the time interval for which you want to receive data.
In the header of the Accept
request, pass the data output format: Accept:application/csv
.
Method:
POST /api/2.0/virtualization/reports/tenants?tenantId={tenant ID
}&from={date and time
}&to={date and time
}
where:
tenantId={
tenant ID
}
– tenant identifier in the Integration Server database. If a tenant is specified, the report includes only information about periods of protection of the virtual machines of this tenant. If a tenant is not specified, the report will include data on all virtual machines that were protected during the specified period.from={
date and time
}
– start date and time of the reporting period in YYYY-MM-DDThh:mm:ss format. If the value is not specified, the date of the earliest record in the Integration Server database is used.to={
date and time
}
– end date and time of the reporting period in YYYY-MM-DDThh:mm:ss format. If the value not specified, the current date is used.
The request is executed asynchronously, REST API returns identifier of the CreateTenantReport task. Using the task, you can monitor the progress of the report generation procedure. When the task execution completes, the result field displays the report identifier or an error message.
Return codes:
202 (Accepted)
– the request is accepted for execution. The response returns the identifier of the CreateTenantReport task.403 (Forbidden)
– access to the resource is denied.404 (Not Found)
– a tenant with the specified identifier is not found in the Integration Server database.
Report upload
Allows you to upload a report generated before.
In the header of the Accept
request, pass the data output format: Accept: application/csv
.
The report can be uploaded in parts. You can specify the data range in the Range
request header, for example:
Range: bytes=0-1023
In response to a request with this header, the REST API returns the 206 (Partial content)
result and the first kilobyte of data. The response contains the Content-Range
and Content-Length
headers.
For example:
Content-Range: bytes=0-1023/123456
Content-Length: 1024
Method:
GET /api/2.0/virtualization/reports/tenants/{report ID
}
where:
{
report ID
}
– report identifier obtained as a result of successful completion of the CreateTenantReport task (required parameter).
Return codes:
200 (OK)
– request completed successfully. The response returns the report data in the format specified in theAccept
header.206 (Partial content)
– request completed successfully. The response returns the part of the report specified by theRange
heading.403 (Forbidden)
– access to the resource is denied.404 (Not Found)
– report with the specified identifier is not found.415 (Unsupported Media Type)
– unsupported format of the requested data (incorrect format was passed in theAccept
request header).