Summary
N2W offers a comprehensive RESTful API interface that allows users to automate all actions that can be performed manually via the UI. However, initial adoption of the RESTful API may present some challenges. These examples have been developed to assist customers in understanding our APIs and to facilitate their use.
Description
Note: The provided code serves solely as an example to aid in understanding our APIs. It is supplied without warranty or support. Users are responsible for thoroughly testing and fully understanding the code before deploying it in a production environment.
Details of the examples:
The intended audience for these examples is developers. Each example file contains a comment indicating the version of CPM used in its creation.
The attached zip file includes the following files:
- Utils.py – A utility class containing functions used across multiple example files. For instance, it includes the requests.post function that manages API calls for the various examples.
- WorkingWithAPIKEY.py – A general example demonstrating how to obtain and refresh tokens.
- WorkingWithPolicies.py – A general example showcasing various policy-related APIs (such as retrieving, listing, creating, updating, and deleting policies, as well as listing targets).
- WorkingWithRecovery.py – A general example illustrating various recovery-related APIs (including retrieving information and performing recoveries).
- WorkingWithReports.py – A general example demonstrating various reporting APIs (including audit, backup, and summary reports).
CustomExcelReport(AWS).py – A scenario-based example that collects information from the environment (such as policy lists, account lists, backups, recoveries, etc.) and consolidates it into a single xlsx file.
Tip: Understanding how an operation is performed via the UI can facilitate its automation using the RESTful APIs. For example, when recovering an EC2 instance, you must select the backup record in the Backup Monitor and then choose the relevant snapshot for recovery. Similarly, when performing this operation via the APIs, it is necessary to first gather the required information (backup record ID, snapshot ID, etc.) before invoking the recover API command.
How to Obtain the API Key:
Each user is assigned a unique API key. To enable API access and generate your key, navigate to User → Settings.
Next, click on API Access, enable the checkbox, and then generate and save the API Authentication Key.
Comments
0 comments
Please sign in to leave a comment.