I have a webroot path of a parent node and would like to return the children of this node. Using https://demo.getmesh.io/api/v1/demo/webroot/images/ for example just yields the node itself.
There is currently no way to load the children of a node via REST using a single request. You can however load the node of the path. Use the uuid of that node and load the children via /api/v1/:projectName/nodes/:nodeUuid/children
A much more elegant approach however would be to use the following graphql query. I highly recommend this option since it is more efficient when handling large datasets.
Background: Computing the totalCount
/ totalPage
size is costly and you can avoid this by using hasPreviousPage
and hasNextPage
.
You can use the following graphql query:
query ($path: String) {
node(path: $path) {
children(perPage: 5) {
hasNextPage
hasPreviousPage
currentPage
elements {
uuid
fields {
... on vehicleImage {
name
}
}
}
}
}
}
Query variables:
{
"path": "/images"
}