ONTAP Rest API Discussions

Coffee breaks with REST - Episode #3: Getting Hands-on with ONTAP REST using Postman

qw
NetApp
3,439 Views


In episode #2 of “Coffee breaks with REST,” we looked at features of NetApp® ONTAP® REST APIs. The best way to understand how APIs work is to get hands-on experience in using them. In this third episode of the blog series, learn how to use the Postman application to get started with basic API calls in ONTAP REST APIs.

What is Postman?

If you’re new to automation with APIs, Postman is an application you need to start your hands-on experience. Postman is an interactive and automatic tool for verifying the APIs of your project. It presents a friendly GUI for constructing requests and reading responses to interact with HTTP APIs. It works on the back end and makes sure that each API is working as intended.

Postman is the tool of choice for many tasks — testing, debugging, accesibility, and collections.

Assuming that you have the Postman application installed on your local machine, let’s see how sample GET and POSTs call can be invoked using Postman.

GET call in Postman
Use case: Retrieve the NetApp SnapMirror® policies in a cluster.

In Postman, follow these steps:

  1. Open a new tab from Postman Collection.
  2. Select the GET call from the drop-down menu, as shown in following screenshot.
  3. Enter the API endpoint in the text input field.
  4. Choose to display the selected fields by passing the fields in the format <<fields = a,b,c>>.
  5. Enter the authorization credentials of the cluster to execute the API endpoint, then click Send.
  6. Choose the format to display the output, such as Text, JSON.
  7. View the desired output for the API call.

Get Call - ONTAP REST APIsGet Call - ONTAP REST APIs

                                                                                                                                      

POST call in Postman
Use case: Create a Snapmirror policies at cluster scope by passing input parameters
In Postman, follow these steps:

  1. Open a new tab from Postman Collection.
  2. Select the POST call from the drop-down menu, as shown in the following screenshot.
  3. Enter the API endpoint in the text input field.
  4. Enter the authorization credentials of the cluster to execute the API endpoint.
  5. Input the parameters in the body section and click Send to call the API.
  6. View the desired output for the API call.

    POST Call - REST APIsPOST Call - REST APIs
    7.  The JOB ID is returned as an href link. Click the hyperlink to see the response status. Be sure to pass the cluster credentials in the Authorization section.
    Job call - Returns Status of POST call - only for asynchronous jobJob call - Returns Status of POST call - only for asynchronous job

     

    In the next episode of “Coffee breaks with REST,” we’ll see how to execute the curl commands and Python scripts available in GitHub to get started on the ONTAP REST APIs journey.

 

1 REPLY 1

darb0505
3,034 Views

Really enjoy this Coffee breaks with REST.  Thank you for providing this information on REST API

 

 

Team NetApp
Public