The Nutanix REST API allows administrators to create and run scripts on their Nutanix clusters. On a Nutanix cluster:
- API v1 and v2 runs through the Prism service.
- API v3 runs through Aplos services.
Both of the above are services running on a CVM/PC-VM in a Nutanix cluster.
Prism: Prism is the management gateway for component and administrators to configure and monitor the Nutanix cluster. This includes Ncli, the HTML5 UI, and REST API. Prism runs on every node in the cluster and uses an elected leader like all components in the cluster.
All v1 and v2 API calls runs through Prism.
Aplos: It’s an intentful orchestration engine + intentful API proxy. All v3 REST API calls runs through Aplos.
Looking at the logs of the above 2 services can tell us a lot of things about our REST API and HTTP issues on PC-VM/CVM. The logs for these services are located on a CVM/PC-VM at:
- API v3 logs: ~/data/logs/aplos.out
- API v1 and v2 logs: ~/data/logs/prism_gateway.log
HTTP defines a set of request methods to indicate the desired action to be performed for a given resource. REST APIs are capable of sending GET, POST, PUT, and DELETE HTTP requests.
Generally, the four primary HTTP request methods most widely used are:
-
GET: Read a specific resource (by an identifier) or a collection of resources. . Requests using
GET
should only retrieve data. -
PUT: Update a specific resource (by an identifier) or a collection of resources. Can also be used to create a specific resource if the resource identifier is known before-hand
-
DELETE: Remove/delete a specific resource by an identifier.
-
POST: Create a new resource. The
PUT
method will replace all current representations of the target resource with the request payload.
Sometimes you can get weird HTTP error codes while running REST API scripts and the above logs might not help then you might want to take a look at HTTP/Apache logs for troubleshooting further.
Logs related to troubleshooting HTTP issues can be found inside this location on CVMs/PC-VMs “/etc/httpd/logs”.
And to access these logs you will need to switch to the root user on the CVM/PC-VM like below as you cannot access these logs without being root user:
1)Switch to root user: nutanix@cvm#~$ sudo su
2)Go to directory /etc/httpd/logs: root@cvm#~$ cd /etc/httpd/logs
Inside this directory /etc/httpd/logs you will find such files:
Here you can check files ssl_access.log,ssl_request.log and ssl_error.log log files for debugging more on the issue.
More information about REST APIs can be found here: https://www.nutanix.dev/ and https://www.nutanix.dev/api-reference/.