API - Get a tenants usage by month

Hi all,
is it possible to get the usage of a tenant by month?
The API endpoint /tenants/<id>/usages just shows the latest month. In the json respone I can see a "range_start" parameter. So is there any way to get the usage of a specific month?
We would like to get this information to automate the billing process for our customers.
Thank you,
Daniel

Hi Ivaylo,
thank you for the additional information.
I managed to create the api requests and a report was successfuly saved. I can check the status of the report and everything seems to be ok.
For generating the report I used the json structure from the blog article and changed the tenant_id and the period-start and period-end dates.
However it seems that the report is always generated for the current month and not for the period range I have defined in the json.
This is the json I post:
{
"parameters": {
"kind": "usage_summary",
"level": "direct_partners",
"tenant_id": "<my id>",
"formats": [
"csv_v2_0"
],
"show_skus": true,
"hide_zero_usage": true
},
"period": {
"start": "2022-01-01",
"end": "2022-01-15"
},
"schedule": {
"type": "once"
},
"result_action": "save"
}
And this is the info I get:
{
"schedule": {
"enabled": true,
"type": "once"
},
"version": 1,
"generation_date": "2022-02-08",
"recipients": [],
"id": "<report id>",
"result_action": "save",
"parameters": {
"period": {
"start": "2022-02-01",
"end": "2022-02-07"
},
"level": "direct_partners",
"hide_zero_usage": true,
"kind": "usage_summary",
"show_skus": true,
"tenant_id": "<my id>",
"formats": [
"csv_v2_0"
]
}
}
Do you have any idea why the dates are not set?
Thank you
Daniel
- Log in to post comments

Hello Daniel,
That's an issue, I am able to reproduce it.
We should be able to POST and then GET the report saved for the exact period we specified. I remember it clearly working in the past, which is why I recommended using Reports for this.
Would you mind raising a Support ticket so we can report this to RnD as a real customer issue? Or you can share your company name and any login name from you partner root tenant and I will create a ticket.
Thank you in advance!
- Log in to post comments
Best regards,
Ivaylo Tsvetkov | API Platform Senior Support Engineer
Information provided AS-IS with no warranty of any kind.
To contact support, please follow http://www.acronis.com/en-us/support


{
- Log in to post comments
Best regards,
Ivaylo Tsvetkov | API Platform Senior Support Engineer
Information provided AS-IS with no warranty of any kind.
To contact support, please follow http://www.acronis.com/en-us/support

Hi Ivaylo,
I updated the json and now it works. And yes, I took the example code from the blog post.
Is it correct, that I can only generate date ranges within a month and not more than a month?
Thank you,
Daniel
- Log in to post comments

Hi Daniel,
Not correct, it is possible to specify a custom period longer than a month.
Except for reports where "kind": usage_current which contain the current service usage metrics for the previous day by default and period cannot be specified.
Thank you.
- Log in to post comments
Best regards,
Ivaylo Tsvetkov | API Platform Senior Support Engineer
Information provided AS-IS with no warranty of any kind.
To contact support, please follow http://www.acronis.com/en-us/support
Best regards,
Ivaylo Tsvetkov | API Platform Senior Support Engineer
Information provided AS-IS with no warranty of any kind.
To contact support, please follow http://www.acronis.com/en-us/support