Solved

sort_attribute usage

  • 1 June 2019
  • 2 replies
  • 301 views

I'm exploring the API and noticed that for listing operations (specifically the /vms/list operation) supports providing sorting parameters. I can't find any information on the proper values for the sort_attribute key in the request. Has anyone used this and can shed some light for me?

Thanks
icon

Best answer by nogodan1234 4 September 2019, 09:46

You can specify sort attribute like below
"https://"Prism_Element_VIP":9440/PrismGateway/services/rest/v1/vms/?sortCriteria=vmName

Also you can find other detail from below API guide
https://portal.nutanix.com/#/page/docs/details?targetId=API-Ref-AOS-v510:man-rest-api-v1-u.html

Ctrl+F "sortCriteria"

Hope this clear your question
View original

2 replies

Badge
The only reference I've found indicates that it is "The attribute to perform sort on". I tested this using sort_atribute "vm_name" and I got a sorted list by VM name. HOWEVER when I tried sort_attributes "num_sockets", or "memory_size_mib", or "memory_size_bytes" the list returned was not sorted. I spoke with Nutanix' new API DIrector at .NEXT and he promised better documentation soon. I sure hope so.
You can specify sort attribute like below
"https://"Prism_Element_VIP":9440/PrismGateway/services/rest/v1/vms/?sortCriteria=vmName

Also you can find other detail from below API guide
https://portal.nutanix.com/#/page/docs/details?targetId=API-Ref-AOS-v510:man-rest-api-v1-u.html

Ctrl+F "sortCriteria"

Hope this clear your question

Reply