Search
platform logo

Simplivity

Optimizing GET requests

You can increase the efficiency of the REST API by minimizing the amount of processing that occurs on the server and the amount of data that is transmitted over the network. This page describes a number of ways that you can sort and filter the output of GET requests to optimize them. You can increase the speed of these transactions by eliminating the transfer of unnecessary content.

Request specific fields

If you only need a small number of fields, you can request only these fields. The following example requests only the id and name fields:

GET /api/backups?fields=id,name

Limit the number of objects by relationship

If you only want to retrieve a limited number of objects, you can use filtering parameters to return only objects associated with a particular resource. The following example queries for all backups of a specific virtual machine:

GET /api/backups?fields=id,name&virtual_machine_id=729861fd-a006-4849-bf08-b232551989c0

Sort returned data

To increase the efficiency of the returned data, you can sort these results by most fields. The following example sorts results by the name field:

GET /api/backups?fields=id,name&virtual_machine_id=729861fd-a006-4849-bf08-b232551989c0&sort=name

For most fields, the sort is a case-sensitive lexicographic sort. Numbers come before capital letters, which come before lowercase letters. The REST API service sorts backup names case-insensitively.

Request objects in sorted/filtered chunks

You can use the offset and limit fields to request objects in sorted/filtered chunks. You can set the limit to any integer value up to 5000. The following example sorts results by the name field and requests chunks of 50 results at a time:

GET /api/backups?fields=id,name&virtual_machine_id=729861fd-a006-4849-bf08-
b232551989c0&sort=name&offset=50&limit=50

The REST API always performs sorting and filtering on enumerated values using the full uppercase enumerations. The REST API ignores the value of the case parameter when you sort or filter by fields with enumerated values.

Related Blogs

author logo
Roy Atkins

HPE SimpliVity PowerShell Module

May 16, 2019
author logo
Ron Dharma

Using Postman with HPE SimpliVity

Nov 9, 2018

HPE Developer Newsletter

Stay in the loop.

Sign up for the HPE Developer Newsletter or visit the Newsletter Archive to see past content.

By clicking on “Subscribe Now”, I agree to HPE sending me personalized email communication about HPE and select HPE-Partner products, services, offers and events. I understand that my email address will be used in accordance with HPE Privacy Statement. You may unsubscribe from receiving HPE and HPE-Partner news and offers at any time by clicking on the Unsubscribe button at the bottom of the newsletter.

For more information on how HPE manages, uses, and protects your personal data please refer to HPE Privacy Statement.