Input Arguments
The input arguments that can be used when querying the Search API are discussed in this section.
In order to perform these operations, ensure that you have the proper authentication (if necessary) and user permissions.
Search Arguments
Any query made using the Search API requires arguments. These include language, after, before, first, orderBy, and filter.
Language
Fetching snippet...
After
The after argument in the query is the cursor and is used when you want to paginate search results. The argument takes a string value, which is a base64-encoded version of the offset. In the following query, we’re getting the items after the second item by giving the after argument a value of "MQ==" (base64-encoded version of 1).
Fetching snippet...
You can use the cursor field to get the cursor value for each item. To learn more about this argument as well as pagination, head to the pagination section.
Before
This argument does the opposite of what the after argument does. It gets the values that are before the specified offset value provided to the argument. In the query below, we are getting all the items that exist before the third item by giving the argument a value of "Mg==" (base64-encoded version of 2).
Fetching snippet...
First
This argument allows you to fetch only the amount of items you specify. Let's say you only want to grab the first three items from the search results. This is how you would do it:
Fetching snippet...
orderBy
To order the search results, you can use the orderBy argument. You’ll need to specify the field name and the order direction within this argument. In the following query, we are ordering by name and the direction is set to ascending.
Fetching snippet...
Filter
The search results can be filtered using the filter argument. The items can be filtered using any of the following: search term, type, variants, etc. The query below filters items using the search term 'plant'.
Fetching snippet...