Data query overview
You can write code to query for data you've stored in your API BaaS application. You'll most likely use queries as filters to retrieve specific entities. For example, you might want to get data about users who are "following" a specific other user, businesses in specific geographical locations, and so on.
The following example retrieves a list of restaurants (from a restaurants collection) whose name property contains the value "diner", sorting the list in ascending order by name:
/restaurants?ql=select * where name contains 'diner' order by name asc
Note: Query examples in this content are shown unencoded to make them easier to read. Keep in mind that you might need to encode query strings if you're sending them as part of URLs, such as when you're executing them with the cURL tool.
Having retrieved the list of restaurants, your code could display the list to your users. You could also use a query to retrieve a list of diners that are located within a particular geographical area (such as near your user's current location).
Important: By default, results from queries of your App Services data are limited to 10 items at a time. You can control this with the
limitparameter, as discussed in Query parameters & clauses.
You query your API BaaS data by using a query syntax that's like Structured Query Language (SQL), the query language for relational databases. Unlike a relational database, where you specify tables and columns containing the data you want to query, in your API BaaS queries you specify collections and entities.
Note: The syntax of API BaaS queries only resembles SQL to make queries familiar and easier to write. However, the language isn't SQL. Only the syntax items documented here are supported.
The examples in these topics illustrate queries using simple strings to make the queries easier to read. You can also use one of the Apigee SDKs, which provide functions through which you can pass query strings, and in some cases shortcuts for bypassing queries altogether.
Note: Queries replace filters, which are deprecated.
For more detail about support for queries your API BaaS data store, see the following topics:
Help or comments?
- Something's not working: See Apigee Support.
- Something's wrong with the docs: Click Send Feedback in the lower right.
(Incorrect? Unclear? Broken link? Typo?)