Scenario
Example: query storage volumes on a lab cluster. Replace host and SVM; use a named least-privilege account and a trusted CA certificate.
Before you change production
Commands and screens can differ by release and platform. Replace example names and documentation IP addresses. Check prerequisites, impact, current health and rollback with your change owner.
1. Prepare access
- Confirm ONTAP version and supported endpoint in the REST API reference. Create an account or role with only the required permissions. Use HTTPS with valid certificate validation.
- Keep secrets out of scripts and repositories. Prefer a secure credential store or an approved environment mechanism. Never publish real cluster addresses or tokens on this public site.
Verify
Authenticated access to the API documentation on a lab cluster.
2. Read before write
- Query a small collection with field selection or filters and inspect the response object, pagination and job state.
- For changes, use a test SVM/volume and follow the endpoint schema. Review idempotency, asynchronous jobs and error handling.
Illustrative read-only API request
curl --fail --silent --show-error \
--cacert /path/to/cluster-ca.pem \
--user "${ONTAP_USER}" \
"https://cluster.example.com/api/storage/volumes?fields=name,svm.name,state&max_records=20"3. Validate and log
- Compare API output with System Manager or CLI for the same object. For asynchronous changes, poll the returned job until success or error.
- Record request ID, response status and object UUID without logging credentials. Roll back test changes using the documented API workflow.
Verify
Script handles non-2xx responses, pagination and asynchronous completion.
If validation fails
- If the API returns 401 or 403, confirm the account role and authentication method; do not embed an administrator password in a public script.
- If a collection omits objects, inspect pagination and filters before assuming the objects are missing.
- If a write returns a job identifier, wait for job completion and check its error field before treating the operation as successful.
Verify
Re-run the original validation and record the observed result, exact error, time, and corrective action.