Use the REST API Explorer to retrieve and/or make changes to a cluster
REST API Methods
The HTTP verbs comprise a major portion of our “uniform interface” constraint and provide us the action counterpart to the noun-based resource. The primary or most-commonly-used HTTP verbs (or methods, as they are properly called) are POST, GET, PUT, PATCH, and DELETE. These correspond to create, read, update, and delete (or CRUD) operations, respectively. There are a number of other verbs, too, but are utilized less frequently. Of those less-frequent methods, OPTIONS and HEAD are used more often than others.
Verb | CRUD |
POST | Create |
GET | Read |
PUT | Update/Replace |
PATCH | Update/Modify |
DELETE | Delete |
The Nutanix REST APIs allow you to create scripts that run system administration commands against the Nutanix cluster. The API enables the use of HTTP requests to get information about the cluster as well as make changes to the configuration. Output from the commands are returned in JSON format.
There are two versions of the Nutanix REST API.
- v1: The original Nutanix REST API.
- v2: An update of the v1 API. Users of the v1 API are encouraged to migrate to v2.
The REST API Explorer displays a list of the cluster objects that can be managed by the API. Each line has four options:
- Show/Hide: Expand or reduce the detail shown for the object
- List Operations: Show all operations that can be run on this object
- Expand Operations: Show the detailed view of the operations that can be run on this object
REST API Status Codes
Status Code | Definition |
200 | The API request was successful and received a response. |
201 | The API request was successful and created an object. |
400 | The API request was malformed and could not be processed. |
401 | You have no access and/or are not authorized. |
403 | You are authorized but do not have the privileges for this API. |
404 | The URL was not found. |
405 | The called method is not allowed or is not supported. |
408 | The request timed out (20 seconds maximum). |
500 | The API request was received but there was a server error. |
503 | Service unavailable at this time or too early to process. |
505 | HTTP other than 1.1 not supported. |
Do we get the metrics data_reduction.overall.saving_ratio_ppm, storage.capacity_bytes, storage.free_bytes from API version v1 ?
Yes, I believe so. I was able to pull metrics such as storage.user_usage_bytes, storage.user_capacity_bytes, and storage.user_free_bytes via The Nutanix CMDlets, which leverages the REST API.