Tech ONTAP Blogs
Tech ONTAP Blogs
In the previous blog, I covered how to protect databases and hypervisor workloads using the NetApp Backup and Recovery UI. In today's fast-paced, data-driven world, managing backups and ensuring seamless data recovery have become critical tasks for businesses of all sizes. As organizations scale, the sheer complexity of maintaining data integrity, security, and operational efficiency can feel overwhelming. Manual processes often fall short, introducing inefficiencies and increasing the risk of human error. This is where automation, powered by REST APIs, steps in to revolutionize the backup and recovery landscape.
NetApp Backup and Recovery REST APIs offer a robust and flexible framework to automate and streamline these processes.
Here are the step-by-step guidance to protect SQL Server database using NetApp Backup and Recovery REST API, similar API's can be called to protect other workloads supported by NetApp Backup and Recovery
Getting Started with NetApp Backup and Recovery REST APIs
Before diving into the core steps, you'll need to authenticate and obtain a bearer token to interact with the APIs. Follow the instructions in NetApp's documentation to create a user token.
Once authenticated, you can access the YAML file containing list of all REST API, along with their required and optional parameters. This YAML file serves as your roadmap to automate various backup and recovery tasks for databases.
Note:The example provided below is intended as a general illustration of how to add a database host and protect a database using NetApp Backup and Recovery REST APIs. In real-world scenarios, the specific parameters you’ll use may differ based on the number of databases you want to protect and the type of backup policy you apply.
Also, please note that policy creation is typically a one-time setup process and isn’t covered in this walkthrough. Once your backup policies are defined, you can reference them for multiple protection groups as needed.
Step 1: Add SQL Server host
The first step in the automation journey is onboarding your SQL Server host into the NetApp Backup and Recovery ecosystem. By providing key details such as the hostname, installation path, and plugin port, you can programmatically register the host and prepare it for backup management. Include the bearer token you generated during the authentication in the "Authorization" header of your API request. Some parameters need to be reused across multiple API calls—such as the NetApp Console organization ID, workload type, connector id, and agent ID—so you’ll often re-enter them throughout the workflow
curl --location 'https://api.bluexp.netapp.com/backup-recovery/organizations/8f61f7d6-xxxxxxxxx-adcde9ec708a/v1/workloads/SQL/hosts' \
--header 'x-account-id: account-xxxxxxxxx' \
--header 'x-agent-id: xxxxxxxxx248nohxxxxxxxxxclients' \
--header 'Content-Type: application/json' \
--header 'Accept: text/plain' \
--header 'Authorization: ••••••' \
--data '{
"workloadType": "SQL",
"hostName": "SQL105",
"credentialsId": "ec2753ad-c88b26bd4e43",
"connectorId": "xxxxxxxxx248nohxxxxxxxxxclients",
"pluginPort": 2341,
"installPath": "C:\\Program Files\\NetApp\\SnapCenter",
"skipPreInstallChecks": false,
"useManualInstall": false,
"usegMSA": false,
"addHostsInCluster": false
}'
Step 2: Get list of all instances
Once the host is onboarded, the next step is to verify that all SQL Server instances have been discovered and are listed. This is a critical validation step to ensure that your environment is correctly configured before proceeding with backup operations.
curl --location 'https://api.bluexp.netapp.com/backup-recovery/
organizations/8f61f7d6-xxxxxxxxx-adcde9ec708a/v1/workloads/SQL/
instances' \
--header 'x-account-id: string' \
--header 'x-agent-id: string' \
--header 'Accept: text/plain' \
--header 'Authorization: ••••••'
This API call returns a comprehensive list of all discovered SQL Server instances, giving you full visibility into your environment.
Step 3: Get list of all databases
With your instances in view, the next logical step is to identify which databases are currently unprotected. This API call retrieves a list of all databases, along with their resourceId — a unique identifier that you'll need in subsequent steps to add them to a protection group.
curl --location 'https://api.bluexp.netapp.com/backup-recovery/organizations/8f61f7d6-xxxxxxxxx-adcde9ec708a/v1/workloads/SQL/databases?hostname=sql101&isProtected=False' \
--header 'x-account-id: string' \
--header 'x-agent-id: string' \
--header 'Accept: text/plain' \
--header 'Authorization: ••••••'
Think of this step as taking inventory — understanding what needs to be protected before you can protect it
Step 4: Create a protection group
Now comes the heart of the backup automation workflow — creating a protection group. A protection group is a logical collection of databases that share the same backup policy. By passing the resourceId of the databases and the policyId, you can programmatically create a protection group that ensures consistent, policy-driven backups.
curl --location 'https://api.bluexp.netapp.com/backup-recovery/
organizations/8f61f7d6-xxxxxxxxx-adcde9ec708a/v1/workloads/SQL/
protection' \
--header 'x-account-id: account-xxxxxxxxx' \
--header 'x-agent-id: xxxxxxxxx248nohxxxxxxxxxclients' \
--header 'Content-Type: application/json' \
--header 'Accept: text/plain' \
--header 'Authorization: ••••••' \
--data '{
"policyId": "12",
"resourceIds": [
62
],
"protectionGroupName": "DB_SQLTD_PG"
}'
With this single API call, you've essentially set up a robust, policy-driven backup framework for your critical databases
Step 5: Trigger an on-demand backup
Once your protection group is in place, you can either let the scheduled backups run automatically or trigger an on-demand backup for immediate protection. This is particularly useful in scenarios such as pre-maintenance windows or before major application updates.
curl --location 'https://api.bluexp.netapp.com/backup-recovery/organizations/8f61f7d6-9c79-4038-ac31-adcde9ec708a/v1/workloads/SQL/resources/39/backups' \
--header 'x-account-id: account-xxxxxxxxx' \
--header 'x-agent-id: xxxxxxxxx248nohxxxxxxxxxclients' \
--header 'Content-Type: application/json' \
--header 'Accept: text/plain' \
--header 'Authorization: ••••••' \
--data '{
"policyId": "12",
"tier": "Daily",
"backupType": "FullBackup"
}'
Step 6: View all backups
Visibility is essential for any robust backup strategy. With NetApp REST APIs, you can easily review all available backups for a database, ensuring you always know the status and recovery points of your data.
curl --location 'https://api.bluexp.netapp.com/backup-recovery/organizations/8f61f7d6-xxxxxxxxx-adcde9ec708a/v1/workloads/SQL/resources/62/backups' \
--header 'x-account-id: string' \
--header 'x-agent-id: string' \
--header 'Accept: text/plain' \
--header 'Authorization: ••••••'
Beyond backup: restore and clone operations
The power of NetApp Backup and Recovery REST APIs doesn't stop at backups. Organizations can also automate:
Database Restores — Quickly recover databases to a specific point in time and trigger multiple restore operations.
Database Cloning — Clone databases for testing, development, or analytics purposes without impacting production environments.
These capabilities, combined with the automation potential of REST APIs, make NetApp Backup and Recovery a truly end-to-end data protection solution.
Ready to explore the full potential of NetApp Backup and Recovery REST APIs? Download the YAML file attached to this blog for a comprehensive list of all available API calls, complete with required and optional parameters. Whether you're building custom integrations, orchestrating complex workflows, or simply looking to automate routine tasks, this YAML file is your go-to reference.
For questions, feedback, or assistance, reach out to the NetApp team at ng-backupservice-feedback@netapp.com.
Conclusion
NetApp Backup and Recovery provide a powerful and flexible solution for automating backup and recovery processes. By leveraging REST APIs, organizations can overcome the challenges of manual backup processes, ensure data reliability, and meet compliance requirements more efficiently. Embracing automation not only enhances the consistency and reliability of backups but also frees up valuable IT resources to focus on strategic initiatives. Check out this blog on latest enhancements in NetApp Backup and Recovery.
To understand more about the NetApp Backup and Recovery, refer documentation here.