Thursday, July 11, 2013

Nutanix REST API Browser - How to get Container Info.

Basic Definition:
REST is an alternative to SOAP based web services. Where SOAP tries to model the exchange between client and server as calls to objects, REST tries to be faithful to the web domain. So when calling a web service written in SOAP, you may write
productService.GetProduct("1")
in REST, you may call a url with HTTP GET
http://someurl/products/product/1
CRUD - Create, Request, Update and Delete are done via http requests POST GET, PUT and DELETE respectively.
One can use curl, links, http browser to get the details of the nutanix cluster.

Here is to most inteRESTing REST API!
Now the most interesting Nutanix has became more inteRESTing!
Or we can call Nutanix REST as BeautyREST! (someone already called it sexy! http://wahlnetwork.com/2013/07/01/nutanix-and-veeam-spread-rest-api-joy/)

Nutanix REST API Browser: http://any_Nutanix_CVM 
Login as admin/admin-- Prism Nutanix Browser (HTML5) requires another couple of blogs to go through its goodness. 

To access Rest API browser:


 

Rest API Explorer: https://10.3.101.61:9440/console/api/


To get NFS datastores /Nutanix containers (vstore)
 Get Response:
 

jerome@ithaca:~$ curl https://10.3.101.61:9440/PrismGateway/services/rest/v1/vstores  --insecure --user admin:admin

[{"id":2482,"name":"ctr3","containerId":2482,"backedup":false,"protectionDomain":null,"markedForRemoval":false},{"id":2483,"name":"ctr4","containerId":2483,"backedup":false,"protectionDomain":null,"markedForRemoval":false},{"id":1898767,"name":"ctr5","containerId":1898767,"backedup":true,"protectionDomain":"ctr5_1372277619664","markedForRemoval":false},{"id":2430343,"name":"test","containerId":2430343,"backedup":false,"protectionDomain":null,"markedForRemoval":false},{"id":2430528,"name":"testing","containerId":2430528,"backedup":false,"protectionDomain":null,"markedForRemoval":false},{"id":18973731,"name":"testStats","containerId":18973731,"backedup":false,"protectionDomain":null,"markedForRemoval":false},{"id":19113654,"name":"dummyCTR_to_delete1","containerId":19113654,"backedup":false,"protectionDomain":null,"markedForRemoval":false}]


to get specific container:

 curl https://10.3.101.61:9440/PrismGateway/services/rest/v1/vstores/1898767  --insecure --user admin:admin


{"id":1898767,"name":"ctr5","containerId":1898767,"backedup":true,"protectionDomain":"ctr5_1372277619664","markedForRemoval":false}

1 comment: