Question: Search all containers within a location, including those in its sub-locations, in a single query using API ?
Answer: Below is the requested information on how containers can be searched by location using the API. Please follow the steps outlined below:
- Navigate to the Swagger API page and use the endpoint: POST /entities/search – Search entities

- In Source select "IVT"

- Use the following query (replacing the path
"/testMove"with your actual location path). This will return all containers within the specified location and its sub-locations:
{
"query": {
"$and": [
{
"$match": {
"field": "type",
"value": "container",
"mode": "keyword"
}
},
{
"$prefix": {
"field": "fields.Path",
"value": "/testMove",
"in": "tags",
"as": "text",
"mode":"keyword"
}
},
{
"$match": {
"field": "isTemplate",
"value": false
}
}
]
},
"options": {
"sort": {
"modifiedAt": "desc"
}
}
}
By using this approach, you will be able to retrieve all containers located within the specified path along with their sub-locations.
Comments
0 comments
Article is closed for comments.