Get customer totals

Hi all,
Can somebody help me to get the customer totals (total cloud storage size) via the API?
I managed to create a custom search to a Client ID.

Ok, got it almost.
Is it possible þo only get the csv data?
The first 9 lines contains data i don't need.
I am automating things...
The first 9 lines contain:
sep=,
Tenant name,<DEDACTED>
Report type,Summary for period
Date of report generation,2020-05-12
Reporting period,2020-04-01 - 2020-04-30
Level of detail,All customers and partners (including user details)
- Log in to post comments

When you use API, the way I proposed above, you should receive only CSV data. Your example looks like an e-mailed report which expects to be a little bit more human readable.
- Log in to post comments
Stas Pavlov | Technology Evangelist
Acronis Developer Network | Acronis Cyber Cloud Solutions Portal | Acronis Cyber Platform
For more answers to your questions, try our Knowledge Base and Video Tutorials
Our mission is to create Customers and Partners success. Our management team welcomes your comments and suggestions on how we can improve the overall support we provide to you. Please send your comments, suggestions, or concerns to Managers or submit your feedback here.

I used this in my python script:
report_data = { "parameters": { "kind": "usage_summary", "tenant_id": tenant_id, "level": "accounts", "period": { "start": "2020-04-01", "end": "2020-04-30" }, "formats": [ "csv" ] }, "schedule": { "type": "once" }, "generation_date": "2020-05-12", "result_action": "save" }
- Log in to post comments

Oh, I see. Please use csv_v2_0 for the format. Sorry, I totally forgot about csv format which is by default used for send action reports.
- Log in to post comments
Stas Pavlov | Technology Evangelist
Acronis Developer Network | Acronis Cyber Cloud Solutions Portal | Acronis Cyber Platform
For more answers to your questions, try our Knowledge Base and Video Tutorials
Our mission is to create Customers and Partners success. Our management team welcomes your comments and suggestions on how we can improve the overall support we provide to you. Please send your comments, suggestions, or concerns to Managers or submit your feedback here.

Ok that works but the next problem is dat Partner accounts are not listed here, no totals.
This is my python script i use:
import requests import json import pprint import time account_creds = ''<DEDACTED>', '<DEDACTED>' base_url = 'https://eu-baas.acronis.com/api/2' response = requests.get(f'{base_url}/users/me', auth=account_creds) user_account = response.json() #pprint.pprint(user_account) tenant_id = user_account['tenant_id'] client_info = { 'type': 'agent', 'tenant_id': tenant_id, 'token_endpoint_auth_method': 'client_secret_basic', 'data': {'name': 'vCron'}, } client_info = json.dumps(client_info, indent=4) #print(client_info) response = requests.post( f'{base_url}/clients', auth=account_creds, headers={'Content-Type': 'application/json'}, data=client_info, ) #response.status_code client = response.json() #pprint.pprint(client) client_creds = client['client_id'], client['client_secret'] response = requests.post( f'{base_url}/idp/token', auth=client_creds, headers={'Content-Type': 'application/x-www-form-urlencoded'}, data={'grant_type': 'client_credentials'}, ) #response.status_code token_info = response.json() #pprint.pprint(token_info) auth = {'Authorization': 'Bearer ' + token_info['access_token']} # Create Report report_data = { "parameters": { "kind": "usage_summary", "tenant_id": tenant_id, "level": "accounts", "period": { "start": "2020-04-01", "end": "2020-04-28" }, "formats": [ "csv_v2_0" ] }, "schedule": { "type": "once" }, "generation_date": "2020-05-13", "result_action": "save" } report_data = json.dumps(report_data, indent=4) response = requests.post( f'{base_url}/reports', headers={'Content-Type': 'application/json', **auth}, data=report_data, ) #response.status_code #pprint.pprint(response.json()) report_id = response.json()['id'] version = response.json()['version'] # Fetch Report response = requests.get(f'{base_url}/reports/{report_id}', headers=auth) #pprint.pprint(response.json()) # Wait for 30 seconds time.sleep(30) # Fetching stored reports response = requests.get(f'{base_url}/reports/{report_id}/stored', headers=auth) #pprint.pprint(response.json()) stored_reports = response.json()['items'] stored_report_id = [stored_report['id'] for stored_report in stored_reports if stored_report['report_format'] == 'csv_v2_0' and stored_report['status'] == 'saved'][-1] response = requests.get(f'{base_url}/reports/{report_id}/stored/{stored_report_id}', headers=auth) #pprint.pprint(response.json()) # Download Report open(''<DEDACTED>:/'<DEDACTED>/acronis_report.csv', 'wb').write(response.content) # Delete report response = requests.delete(f'{base_url}/reports/{report_id}/stored/{stored_report_id}', headers=auth)
Basically what i want is get all the Custom_ID and loop trough them and get all the totals.
- Log in to post comments

You've asked in your first message, how to find customers totals. The report you've created and downloaded contains all totals for the partners and customers hierarchy for specified tenant_id, including users details. There are 3 other types of reports:
|
The report will include direct customers and partners. |
|
The report will include all partners. |
|
The report will include all customers and partners |
The report contains totals for all specific usages mentioned here https://developer.acronis.com/doc/account-management/v2/guide/usage-reporting/index
Bellow, the header of csv_v2_0 report.
application.id,application.name,date,infra.backend_type,infra.id,infra.name,infra.owner_id,is_range,measurement_unit,name,pricing.currency,pricing.mode,pricing.price,pricing.total_cost,quota.value,tenant.customer_id,tenant.id,tenant.kind,tenant.name,usage.absolute.production,usage.absolute.total,usage.absolute.trial,usage.delta.production,usage.delta.total,usage.delta.trial,usage.effective.production,usage.effective.total,usage.effective.trial,edition
The field name -- contains name of a usage, for storage there are, depending on an edition and an application, storage, adv_storage, dr_storage, dre_storage etc. and a usage.<type>.total fields contain total usage for a specific storage type for a specific tenant.
If you just want to have kind of "total_storage" field like in /tenant/{tenant_id}/usages response, you may try to use json_v1 and json_v2_0 reports formats.
- Log in to post comments
Stas Pavlov | Technology Evangelist
Acronis Developer Network | Acronis Cyber Cloud Solutions Portal | Acronis Cyber Platform
For more answers to your questions, try our Knowledge Base and Video Tutorials
Our mission is to create Customers and Partners success. Our management team welcomes your comments and suggestions on how we can improve the overall support we provide to you. Please send your comments, suggestions, or concerns to Managers or submit your feedback here.

I cannot get the values as seen in the screenshot.
I need the values that are in the totals.
on all customers and partners i entered a Custom ID
So i need to filter on the Custom ID and than get the total values.
I do not care what the Partners underneeth have as we are billing our partners and not his customers.
Attachment | Size |
---|---|
538115-184622.png | 65.48 KB |
- Log in to post comments

All these total values are in the report. I sure, as I did PoC last week with this report and Excel datasheet. Depending on an edition it will be following values in name field:
Cyber Backup Editions
Standard storage
Advanced adv_storage
Disaster Recovery dre_storage
Cyber Protect Editions
Standard p_storage
Advanced p_adv_storage
Disaster Recovery p_dre_storage.
All the values are in bytes.
Custom ID from the portal are the tenant.customer_id field at the report
The total value for the production storage usage should be at the usage.absolute.production field.
Types:
absolute - absolute usage value for the end of report period as reported to Platform
delta - delta of given usage between report period start date and report period end date
effective - usage value for the end of report period for non-range usages (equal to absolute value) and delta value for range usages
For the storage usage effective and absolute the same.
If you have "old" Disaster Recovery storage, you might find as well dr_storage in your report.
- Log in to post comments
Stas Pavlov | Technology Evangelist
Acronis Developer Network | Acronis Cyber Cloud Solutions Portal | Acronis Cyber Platform
For more answers to your questions, try our Knowledge Base and Video Tutorials
Our mission is to create Customers and Partners success. Our management team welcomes your comments and suggestions on how we can improve the overall support we provide to you. Please send your comments, suggestions, or concerns to Managers or submit your feedback here.
Stas Pavlov | Technology Evangelist
Acronis Developer Network | Acronis Cyber Cloud Solutions Portal | Acronis Cyber Platform
For more answers to your questions, try our Knowledge Base and Video Tutorials
Our mission is to create Customers and Partners success. Our management team welcomes your comments and suggestions on how we can improve the overall support we provide to you. Please send your comments, suggestions, or concerns to Managers or submit your feedback here.