GET /api/nutanix/understanding-rest-api

  • 18 September 2020
  • 0 replies
  • 3009 views

Userlevel 2
Badge +2
  • Nutanix Employee
  • 12 replies

Representational state transfer ( REST ) Application Programming Interface (API) 3.0 is based on an intentful API philosophy. According to the intentful API philosophy the machine should handle the programming instead of the user enabling the datacenter administrator able to focus on the other task

 

There are three publicly available Nutanix APIs. Note that while you may see API v0.8 listed in the REST API Explorer in Nutanix Prism, it is strongly recommended to use v3 APIs wherever possible.  

  • v1 (Prism Element only)

  • v2.0 (Prism Element only)

  • v3 (Prism Central only)

cURL Command Analysis

As an extra step, let’s take the v3 API request above and look at what each part of the command is doing. If you are familiar with using cURL to make API requests, this will look very familiar.

  • curl -X POST – Run cURL and specify that we will be making an HTTP POST request (as opposed to HTTP GET)

  • https://[prism_central_virtual_ip]:9440/api/nutanix/v3/vms/list – Specify the complete request URL

  • -H ‘Accept: application/json’ – Specify the content types the client is able to understand

REST API Explorer can be accessed form Prism element or Prism Central

  1. Log into Prism Central. click on user profile and select rest api explorer
    SCyXP2fpb2C0c7L1QCxukDoeuShxau090AIaNg_VsiErS3vpTtYtOBlGPUO9P6tbUSkY2cMeIE95WpAl2514WQsBZRTMQuTxzBIECaAGuN9geMA9nmJpQeTEnD9bg51oQ0xsP8UJ

  2. Find the line for the object you want to explore and click Expand Operations

F1olyy2DWQtZlVw7JP3aoGcPIF18f7WaUiRZ2Mzs1iXYQat7BF7mRFURjaX-kniHjDk6BTZ1iL_MYARM3RblLfPSrBBMjB7ct3wQ9pJ0FxxarJ-_QcRJ0C1uvqY5O2W6WD-eoBGx

 

For further details and details on each version of API please follow this links

REST API introduction

Nutanix API version

Accessing REST API explorer


This topic has been closed for comments