Question: How do I use FSx for ONTAP REST APIs?

I want to use the NetApp ONTAP REST API to manage my Amazon FSx for NetApp ONTAP resources. How do I do this?ResolutionPrerequisitesThe API requestor must be able to make HTTPS connections to the FSx for ONTAP file system and to the storage virtual machine (SVM) endpoints. For more information, see Using the NetApp ONTAP REST API.Run Hello World on the FSx for ONTAP file system with curlAt the command line interface of a Linux instance on your Amazon Virtual Private Cloud (Amazon VPC) running the FSx for ONTAP file system, do the following:1.    Enter your fsxadmin password and the endpoint DNS name. In the following example command, replace Password and fs-XXXXXXXX.fsx.region.amazonaws.com with the correct values for your use case:$ CRED=fsxadmin:Password$ ONTAP=management.fs-XXXXXXXX.fsx.region.amazonaws.com2.    Run the following command to retrieve the ONTAP software version:$ curl -X GET -u ${CRED} -k "https://${ONTAP}/api/cluster?fields=version"{  "version": {    "full": "NetApp Release 9.10.1RC1P1: Sat Nov 27 18:08:32 UTC 2021",    "generation": 9,    "major": 10,    "minor": 1  },  "_links": {    "self": {      "href": "/api/cluster"    }  }}Example REST API: Get volumesThe following is an example of the GET command used to retrieve volumes:$ curl -X GET -u ${CRED} -k "https://${ONTAP}/api/storage/volumes"{  "records": [    {      "uuid": "504c8162-a435-11ec-bb13-130f21c56a08",      "name": "svm1_root",      "_links": {        "self": {          "href": "/api/storage/volumes/504c8162-a435-11ec-bb13-130f21c56a08"        }      }    },    {      "uuid": "956f5ce9-a435-11ec-bb13-130f21c56a08",      "name": "vol1",      "_links": {        "self": {          "href": "/api/storage/volumes/956f5ce9-a435-11ec-bb13-130f21c56a08"        }      }    }  ],  "num_records": 2,  "_links": {    "self": {      "href": "/api/storage/volumes"    }  }}Note: Some APIs don't run on FSx for ONTAP.Use the NetApp BlueXP API Swagger interfaceYou can access some NetApp ONTAP APIs using the BlueXP r Connector Swagger interface. For more information, see Learn about BlueXP and How to log in to BlueXP (formerly Cloud Manager) API Swagger interface on the NetApp website.The following steps are an example of accessing the Swagger interface using BlueXP and posting credentials.1.    In the BlueXP Connector, select the Help menu, represented by a question mark, then select API.Or, go to the Swagger interface directly (example URL: http://connectorip/occm/api-doc/).2.    Select User Management Operations.3.    Select auth : Authentication operations.4.    Select POST /auth/login, Expand Operations.5.    Select Model Schema.6.    Select Click to set as parameter value under the model schema that displays the following:{"email": "string","password": "string"}7.    In the Value field where model schema is populated, edit the string to provide your correct email and password:{"email": "user@example.com","password": "xxxxxxxxxx"}Note: The email id isn'tfsxadmin. The email is the Cloud Central Auth0 email id used to log in to the BlueXP Connector. The password is set in plain text.8.    Select Try it out!9.    Verify that the login is successful from the Response Code.Example: Get volumes API using the BlueXP Swagger interface1.    In the Swagger interface, select FSx (Data ONTAP cluster) working environment operations.2.    Select fsx/volumes.3.    Select GET /fsx/volumes, Expand Operations.4.    In the Value field, enter the file system ID that you want to retrieve the volumes list from.5.    Select Try it out!6.    Verify that the login is successful from the Response Code and the Response Body.

Related informationONTAP REST API Python sample scripts now available on GitHub