Query by Tag with the REST API

This page gives you an explanation and examples of how to query documents by their tags.

The predicate

Here is the predicate you need when querying all of the documents of a certain custom type. To do this, we will need to use the at predicate.

Copy
[at(document.tags, ["{tag}"])]

You just need to enter the tag that you are looking for. The following is the predicate to query all the documents with the tagĀ featured.

Copy
[at(document.tags, ["featured"])]

Example 1

This is an example of a query of all the documents with the tag "English".

Here is the required parameter for this query:

all with tag "English"

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

Example 2

This example shows how to query all of the documents with either the tag "Tag 1" or "Tag 2". In this case we will need to use the any predicate.

Here is the required parameter for this query:

has either tag

q=[[any(document.tags,["Tag 1","Tag 2"])]]