Use Multiple Predicates with the REST API

This page shows how to use two or more predicate in a single query.

Using more than one predicate in a query is as simple as adding the extra predicates the same way you add the first.

Example 1

Let's say that you have a query for all documents of the type "blog-post". You would use the q=[[at(document.type,"blog-post")]] parameter in the form when querying the API.

If you wanted to further specify the query to only include those documents with the tag "featured", then you would simply submit an additional query parameter to the form.

These two queries will then stack on top of each other. This means the query will return only the documents of the type "blog-post" that also contain the tag "featured".

all of type "blog-post"

q=[[at(document.type,"blog-post")]]

has the tag "featured"

q=[[at(document.tags,["featured"])]]

Example 2

This is another example that uses the same concept to query all of the documents of the custom type "employee" excluding those with the tag "manager".

Here are all the required parameters:

all of type "employee"

q=[[at(document.type,"employee")]]

excluding the tag "manager"

q=[[not(document.tags,["manager"])]]