Content API queries

Builder public api key
de02ccd6d7a445df9a0fb721c02fcb41

What are you trying to accomplish
I’m trying to work on some queries to get CMS data

Screenshots or video link

Code stack you are integrating Builder with
NextJS

So as a summary of the video, I am unsure why I am unable to query “url” with
“query.data.url” or “query.data.url.$eq” but it works with just “url”

My understanding is that once I get the shape of my data without specifying any query, I would be able to apply a query on it as per the shape structure. That doesn’t work for me.

Lastly, how do I enter a $regex query in API explorer? How do I code that in builder.getContent call? Please use: /\/dashboard.*/gi as an example

Thanks!

Hi @karlo.medallo, Welcome to Builder.io Forum!

You can find some more details about this here: Querying Cheatsheet - Builder.io

Thanks for your reply, but it still does not work. I think matching against “data.url” is not working. as you can see in my video, even a regular $eq does not work.

Is this a limitation? Can I only match against custom fields I created?

Hi @karlo.medallo

I think you just need to fix the query. Try this in the API explorer, it should work

You may find more details about this here: Builder.io Content API - Builder.io

Let us know if you have further questions!

Just for anyone who stumbles across this as I did, .$eq didn’t seem to work for me at all. To query data, I had to do the following:

query: {
  'data.customAttribute': 'query-value'
}

And that even worked with a JSON field nested property:

query: {
  'data.customJsonData.customNestedProp': 'query-value'
}

It’s unfortunate that (again) the incorrect documentation cost me even more time.

1 Like