A question came up on our community about a Chrome extension called Advanced REST Client and I had never used it before, so I decided to check it out. InstallĀ it here. It will add an extension that allows you to make REST calls to, well whatever from your Chrome browser.
***UPDATE My coworker Barkz did an excellent post about this a few months back too, so check it out too***
Of course there are a billion ways to do this (I traditionally have just used Invoke-RestMethod in PowerShell) but this is another one for your tool arsenal . A quick and easy way to pull REST information from the FlashArray without having to learn another tool like PowerShell to do it.
Non-disruptive install and then you can launch the extension.
So the first step is to create/fetch the API token for your user with the following command:
https://10.21.10.17/api/1.4/auth/apitoken
Replace the IP with your FlashArray IP or FQDN.
You need to add the username and password values into the payload section of the call, with the content-type set to url encoded.
Do that and hit send. Make sure “post” is selected. You will get a response with your API token, you need this to create an maintain the session.
You can always see/get/create the tokens from the GUI too:
Use the following command to create the session:
https://10.21.10.17/api/1.4/auth/session
So i have seen some mixed luck with the next step, the best way to do this is to not put the API token into the payload, but instead as a query parameter. Expand the REST call and add the api_token into the parameter.
That’s all you need to enter for that. If all goes well, your response will be the username associated with that token ID.
Now you can run your REST calls for info:
So a standard call like:
https://10.21.10.17/api/1.4/volume/testcody
Remember to change the radio selection to GET!
Or if you want to add parameters, expand the call and add query parameters. So if I want more space capacity information, using the call:
https://10.21.10.17/api/1.4/volume/VMForkDatastore1?capacity=true
Add the capacity binary option into those query parameters.
Pretty straight forward! Lots of other REST clients of course, but this is a nice one because I spend so much time in Chrome anyways.
As always, you can find the REST API documentation in your FlashArray GUI!
Hi Cody,
I would like to use rest api (1.5) to get historical stats from pure array with : api/1.5/volume?action=monitor&historical=7d
But I don’t wand to have all the history but only the last 2 collected value (which are averaged on 30 mn thanks to the “7d” historical resolution) for each volume. So to easily calculate an “1 hour” average value for those performance metrics.
I’v looked at the documentation but I didn’t find anything. Is there any parameter to get only last n value for performance metrics ? Or at least the last value ?
Thanks.
Hello Cody,
Do you have an example to rename a volume through the REST API?
Check out the reference guide: https://support.purestorage.com/@api/deki/files/12387/FlashArray_REST_API_1.17_Reference_Guide.pdf?revision=1
It would be a PUT call and supply the new name in the body
PUT https://pure01.example.com/api/1.17/volume/v5
{
“name”: “v5_renamed”
}