I would like to either use the REST API or builder.get() option to query results to display on a blog home page. For example, I’d like to find all posts with the “featured” field marked as “true”.
This field is contained in a custom component called “PostDetails” that is nested within another custom component called “Layouts”. Here’s the basic structure for each of the blog pages I wish to query:
Layout (custom component)
Header (symbol)
PostDetails (custom component I'd like to query)
Footer (symbol)
This is the data structure that builder provides, when I drill down to find the “featured” field:
data.blocks.0.children.1.component.options.featured
I tried following this Builder post, to apply my structure (and variations thereof) and the response comes back as “undefined”:
const builderDataResponse = await builder.get('blog', {
query: {
data: {
blocks: {
children: {
component: {
options: {
featured: "true"
}
}
}
}
}
}
}).promise();
I’ve also tried variations on the REST API theme, like so and that keeps returning “{“results”:}”:
https://cdn.builder.io/api/v3/content/blog?apiKey=9c03b50b10da46b088d2dd4aedb8cd93&query.data.blocks.children.component.options.featured=true
I think I’m getting stuck on the “children” part of the query, but that’s just speculative. Has anyone done this sort of query successfully before? Thanks in advance for any help and thoughts!