Acronis #CyberFit Developer Training Part IV: Reports Management, Locations, and Infrastructure Information

This is the forth and the last part of the course focusing on reports management. The first part can be found here Acronis #CyberFit Developer Training Part I: Get Started, Authorization, and Tenant Management and the second here Acronis #CyberFit Developer Training Part II: Offering Items and Applications Management, the third part here Acronis #CyberFit Developer Training Part III: Users Management and Usage Information for UI/UX.

The hands-on manuals, hands-on code, and presentations are for the full course.

Business Automation and account management training course is focused on the Acronis Cyber Platform Account Management API. It provides you the knowledge and hands-on experience you’ll need to successfully automate the provisioning of accounts, applications, offering items, quota management, user creation, and activation, as well as reports management and much more.

The training’s Hands-on Manuals

The training’s Hands-on Code

  1. Bash
  2. PowerShell
  3. Postman
  4. Python

The training's presentation in PDF

Account Management API

Reports Management

Reports allow you to have detailed statistics of the usage of your services. All operations with the reports in the cloud platform are located under the /reports endpoint.

The reports use bytes and Management Console shows usages in gibibytes (GiB), which are 1024^3 bytes as measurement units for storage space.

The platform enforces the following rules for the reporting period

  • Report period must not be in future
  • If the tenant was renamed, the report will contain the latest name of the tenant within the provided period.

Create Report

To create a report, you need to call: 

POST /reports

With JSON build according to needed reports settings. A JSON example is below

{
    "parameters": {
        "kind": "usage_current",
        "tenant_id": "{tenant_id}",
        "level": "accounts",
        "formats": [
           "csv_v2_0"
        ]
    },
    "schedule": {
        "type": "once"
    },
    "result_action": "save"
}

Download Stored Reports

In case of result_action set to save to download your reports your need query stored reports:

GET /reports/{report_id}/stored

The result is an array of JSON stored report objects with root items. A JSON example is below

{
    "items": [
        {
            "id": "cc593092-8820-45f4-a347-35e0979a5bd6",
            "report_format": "csv_v2_0",
            "created_at": "2020-02-04T10:37:53+00:00",
            "size": 2467,
            "status": "saved"
        }
    ]
}

In case of a big report, you need to pull the information until the status became saved.

Then, to download the stored report you need to build the following URL:

GET /reports/{report_id}/stored/{stored_report_id}

The result is a gzipped octet-stream, so you need to use the corresponding tooling to receive the final un-gzipped report file.

Other Reports API

There some other APIs to manage reports like to retrieve created report list etc. which might be useful to manage your reports.

Offering Items to SKUs Mapping

Together with offering items to SKUs mapping tables, you can use usage reports to create billing reports for themselves or for your partners and customer.

The mapping tables for February 2021:

Locations and Infrastructure Information

Locations are the groups registered on the platform, which incorporate infrastructure components. Storage is represented as an infrastructure component, like Acronis-hosted cloud storage or partner-hosted storage, that can be registered on the platform, and offered in the form of an offering item.   

Force deleting storage will delete all data related to the storage, and this operation is irreversible. To delete a location, you first need to delete or move storage.

To have a possibility to filter offering items based on locations and storages, you need to know a list of locations and storages available for you in your DC.

All storage for a customer should be from 1 location.

To have a list of all locations available, you need to perform the following request for your main (root) tenant:

GET /tenants/{tenant_id}/locations

To have a list of all storages available, you need to perform the following request for your main (root) tenant:

GET /tenants/{my_tenant_id}/infra

The results for both cases is JSON with UUIDs of locations and storages.  Then you can use /locations and /infra endpoints to retrieve detailed information by UUID.  

Summary

With the last part of Acronis #CyberFit Developer Training for Bussiness Automation, you now know how to manage reports and retrieve locations and infrastructure information.

Happy developing!

Updated
Stas Pavlov
Technology Evangelist
Account management API
Acronis Cyber Platform