Help Center
Query Builder REST API Query Type

Query Builder REST API Query Type

This overview will describe all the Query Builder’s REST API Query type settings, which is part of the JetEngine plugin.

JetEngine Listing Grid functionality, Tables, and Charts Builders allow you to display the items received via the REST API Endpoint on the front end. However, it doesn’t allow you to query the results. Query Builder fixes that issue. The REST API Query Type gives you the opportunity to create a query of items obtained via the REST API Endpoint.

How to Set Up REST API Query Type

For example, we got the REST API Endpoint from the Custom Content Type with items containing information about movies.

Proceed to JetEngine > Query Builder and click on the “Add New” button. Name a new query and select the “REST API Query” Query Type.

After that, you will see two features of the REST API Query:

rest api query settings
  • From Endpoint. In this drop-down menu, you will see the list of all Endpoints you created for the website. Choose the one you need;
  • Query. This is the section that allows you to create a query. Insert the name of the meta field into the Key bar, and afterward, type the value into the Value text area. If the value of the key meta field is equal to the value in the Value bar, the item will be added to the list.

As a Value, you can also select one of the macros from the list. Learn more about them from our Macros Guide.

rest api query macros

For an instant, you could enter the author ID meta field name as the Key and “Current user ID” macros as the Value. So the user will see only the items of his authorship on the page.

using of macros in query example

For a start, we have created a query without keys and values. 

query without keys and values

Dynamic Table based on this query shows all items.

dynamic table created with the query

Open the API Endpoint URL in your browser. You could use any code editor to organize items like that.

code editor

In this screenshot, the black text areas are keys that are meta fields. The green text areas are values.

For example, we have chosen the “contentRating” key and the “R” value.

adding new key and value to the query

Then, we created the Dynamic Table with this query. As we have set up the query, it shows only movies with the R content rating.

table preview

If you add a new Key and Value to the query, you can narrow down the result. E. g., we have entered the “genres” key and the “Horror” value.

narrowing query with new key and value

And now, the table shows only two items with the Horror and R values.

dynamic table with the final result

REST API Query with 3rd Party API

There should be no problem querying REST API Endpoint, which has been gotten from JetEngine Custom Content Type, such as one with movies we have queried before. But REST API Query doesn’t work with all APIs.

We have a REST API data table demo based on IMDb API. You can create a similar table with the same API gotten from the IMDb API documentation, but you won’t be able to query it.

That’s because when you add keys and values to the query, they appear after a question mark “?” in the endpoint. In other words, IMDb API has a path parameters type. Query string parameters type for APIs is required for the Query Builder.

However, you can query IMDb items directly on the IMDb API documentation page.

imdb api documentation page

That’s all. You now learned how to configure REST API Query, use keys and values, and what 3rd party APIs are suitable for the JetEngine Query Builder. 

Was this article helpful?
YesNo

Need help?

Ask Facebook community

Get answers from 22K Crocoblock Community experts from all over the world.

Start a live chat

Ask question to support agent and share its details via chat messages.