[openstack-dev] Support for multiple sort keys and sort directions in REST GET APIs
Steven Kaufer
kaufer at us.ibm.com
Wed Apr 2 18:42:26 UTC 2014
I have proposed blueprints in both nova and cinder for supporting multiple
sort keys and sort directions for the GET APIs (servers and volumes). I am
trying to get feedback from other projects in order to have a more uniform
API across services.
Problem description from nova proposal:
"There is no support for retrieving server data in a specific order, it is
defaulted to descending sort order by the "created date" and "id" keys. In
order to retrieve data in any sort order and direction, the REST APIs need
to accept multiple sort keys and directions.
Use Case: A UI that displays a table with only the page of data that it has
retrieved from the server. The items in this table need to be sorted by
status first and by display name second. In order to retrieve data in this
order, the APIs must accept multiple sort keys/directions."
See nova proposal .rst file (cinder is basically the same) for more
information: https://review.openstack.org/#/c/84451/
Most projects have similar GET requests and I am trying to get some
consensus on this approach across the various projects; the goal is to have
this type of functionality common across projects (not just nova and
cinder). Note that some projects (ie, cinder) already support a single
sort key and sort direction, see
https://github.com/openstack/cinder/blob/master/cinder/api/v2/volumes.py#L212-L213
Note that the DB layer already accepts multiple sort keys and sort
directions (see
https://github.com/openstack/oslo-incubator/blob/master/openstack/common/db/sqlalchemy/utils.py#L62),
the work I am describing here only exposes the sorting options at the REST
API layer.
Please provide feedback on this direction. Specifically, do you see any
issues (and, if so, why) with allowing the caller to specify sort orders
and directions on the GET APIs?
Feel free to leave your feedback in the Gerrit review for the nova
blueprint or reply to this thread.
Thanks,
Steven Kaufer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20140402/2177f743/attachment.html>
More information about the OpenStack-dev
mailing list