Note: Please go to docs.rightscale.com to access the current RightScale documentation set. Also, feel free to Chat with us!
Home > Guides > RightScale API 1.5 > Overview > Filtering and Views

Filtering and Views

Table of Contents

Most index and show requests have a list of available "views". Each view defines how many attributes and/or expanded nested relationships to include. For example, for querying instances, one can use the "inputs" view which will include expanded inputs contents of every instance in the response. There is always a "default" view, which is used if no explicit view is specified. Some resources will have a "tiny" view, which will only includes the self URL link (i.e., for when one only needs to collect resource "hrefs" rather than their contents).

Collection requests can restrict the results received using a set of available filters. For example, the instances collection resource can be used to retrieve all instances that belong to a given deployment. This is done by specifying a filter that limits the result set to the instances whose deployment relationship matches a deployment href. Multiple filters can be specified in a single request, and they will be ANDed. This means that a request with multiple filters will only return resources that satisfy all of them. Each individual filter can use "==" or "<>" to match or differ on the attribute value. For example, one can filter instances that match a given template and that do not match a given name pattern. Some filters allow partial matches and some require exact value matching (the semantics of each filter are described in the online API Reference documentation).

The sets of views available on a resource's index and show calls are identical, it is thus possible to get the same level of information for a set of resources using index as for an individual resource using show. Some resources contain information that is not appropriate for index calls due to computational expense or sheer size. In those cases the information is exposed using separate GET actions on the individual resource. For example, the details of an audit entry cannot be retrieved using show/index, instead the detail action must be called.

Example filters:

  • filter[]=name==my_php_server
  • filter[]=deployment_href==/api/deployments/11

See also

Some API Examples in this guide include a Supplemental portion that includes a filter or view.

You must to post a comment.
Last modified
23:17, 16 May 2013

Tags

Classifications

This page has no classifications.

Announcements

None


© 2006-2014 RightScale, Inc. All rights reserved.
RightScale is a registered trademark of RightScale, Inc. All other products and services may be trademarks or servicemarks of their respective owners.