Skip to main content

Get Children Name + Quotas

Thread needs solution
Beginner
Posts: 2
Comments: 1

I've just started to dabble with the API and I'm trying to understand how to obtain my children clients quotas.

I'm using the below URL which is returning all my of children via ID.
I don't understand how to return them via Name rather than ID?

{{base_url}}/api/2/tenants/{{my_tenant_id}}/children

 

Secondly once I've managed to get the children showing by name I want to show how much usage they have left, 90/100GB for instance.

Is this possible? 
Apologise rather new to this and getting fairly stuck :)
Thanks!

0 Users found this helpful
Acronis engineer
Posts: 0
Comments: 84

Hello Connor,

Thank you for posting your request.

The smart way to do this is using GET /tenants endpoint and pull the children as a batch of tenants using the filter parameters that this endpoint provides: https://developer.acronis.com/doc/account-management/v2/reference/index…

You have two possible options:
- To fetch only the direct children of a tenant, you can use the parent_id filter parameter. Depending on what tenant_id you input (any ID from your organization, from any sub-tenant) the request will fetch the direct children of this tenant.
- You can also fetch all direct and non-direct children of all your sub-tenants at once by using the subtree_root_id which will also include the tenant details of the used tenant_id and the users of all the customers tenants which are considered as Unit tenants.

parent_id - the UUID of a tenant which child tenants will be fetched. Is mutually exclusive with 'subtree_root_id' and 'uuids'.
subtree_root_id - filter to fetch tenants hierarchy starting from (inclusive) the specified one. Sorting by tenant level is always assumed. Mutually exclusive with 'uuids' and 'parent_id'

Note that unlike GET /tenants/{tenant_id}/children where we get the IDs only in a list, we cannot fetch only the children names value with GET /tenants endpoint, we are fetching complete details for the tenants in the response. You should look for "name" attribute in the response in each fetched item.

I've updated our Postman collections for this endpoint where you can quickly test with both parameters and see the results: https://www.postman.com/grey-rocket-585331/workspace/acronis-cyber-plat…

 
However fetching the names of the tenants is not going to help you for fetching the usages of these tenants, you will still need to provide their tenant UUIDs in the request and the usages response will only associate the offering items' usage and quota by the tenant_id - of course you can pull this data separately, store the names and UUIDs first to have a relation in a table and then add the usages and quotas into other columns.

To fetch usages in batch mode, you need to prepare a batch, a set of tenant UUIDs for which you'd like to pull the data by using GET /tenants/usages with the required batch tenants parameter (tenant UUIDs separated by comma), and also you have options to specify the exact editions and/or usage_names filter parameters.

Link to endpoint: https://developer.acronis.com/doc/account-management/v2/reference/index…

I have updated the endpoint example in our Postman collections to fetch also usages for our Per GB and Per Workload licensing models as they were missing. Legacy editions can still be fetched till they are officially deprecated. To test the endpoint you can remove the non-necessary values from the editions parameter: https://www.postman.com/grey-rocket-585331/workspace/acronis-cyber-plat…

I hope that this solution will be helpful.