Skip to main content

pre/post script arguments

Thread needs solution
Posts: 3
Comments: 0

Is there a way to retrieve the backup id,or any other unique identifier to the backup (not the device), inside of the pre/post scripts? Alt. pre/post capture data scripts. Thanks!

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

Hello Malin,

Thank you for your post.

The protection plan, along with all its sub-policies, their identifiers and their settings is retrieved with GET /api/policy_management/v4/policies?include_settings=true or GET /api/policy_management/v4/policies/{policy_id}?full_composite=true&include_settings=true where for example for the pre/post data capture commands the settings can be seen in the policy item where "type""policy.backup.machine" in "settings"."pre_post_commands" object. This however doesn't show the content of the scripts themselves, their source code.……

Information about Backups, Archives and Vaults can be fetched by using the Vault Manager API:

For example you can follow below steps to retrieve Backup information once authorized:
1. GET /api/resource_management/v4/resources?type=resource.machine to get the list with machine resources.
2. GET /api/vault_manager/v1/archives?resourceId={resource_id}&order=desc(created) with a resource UUID selected from the response of the previous call to list all its backup archives.
3. GET /api/vault_manager/v1/backups?resourceId={resource_id}&limit=1&order=desc(created) to get its latest recovery point from the backup archives, or without limit=1 to get all the backup recovery points from the backup archive linked with that resource.

In both cases (2 and 3), for the DELETE methods for archive ID and backup ID, you need to select the value from the legacy_id attribute. Note that we only DELETE backup's/archive's metadata associated with the backup/archive, not the backup/archive itself (from the storage). Deletion from storage will be available in future, for now we only cover scenarios where backups were deleted manually but because of unhandled deletion of metadata archive may still appear in the Protection Console. Otherwise, the values from "id", "backup_id", "archive_id", etc. are the IDs referenced in other protection operations responses. Along with IDs, you may find a lot other information about backup and archives in their respective responses.

If you target all of the above data with an access token issued from the customer tenant itself, you can authorize with the Account Management API Bearer access token. However if you authorize with same type of token but from a partner's tenant account, you'll need the Scoped access token for customer tenant's protection operations which is done following this Postman example:… - here you pass the Bearer obtained previously plus the target customer tenant_uuid (issued for each tenant separately).

Let me know here in the post should you have any additional questions on these topics.

Thank you.