This post will provide guidance on which queries can be used to generate a list of Groups, and Assets within those Groups, from your ExoSense instance. This post will assume some basic familiarity with GraphQL.
Query 1: assets
- Can return a list of all Assets in your instance, regardless of whether the Assets are more than one-level down in the Group hierarchy.
- Top level items in the list will be Assets. Your script will need to iterate over the list and sort them if you want them sorted by Group.
- Note: You can also use the
AssetFilters
parameter of this query to pre-filter the returned list of Assets (e.g. to filter bygroup_id
)
- Note: You can also use the
Example Query
query assets($pagination: Pagination) {
assets(pagination: $pagination, includeTemplates: true) {
id
name
parent {
id
name
}
}
}
Example Variables
{
"pagination": {
"limit": 100,
"offset": 0
}
}
Query 2: groups
- Top level items in the list will be Group objects. Groups will not be nested by position within the hierarchy.
- The optional
parent
field will return the Group each given Group is a child of, allowing your script to replicate the hierarchy in a nested data structure.
Example Query
query groups($pagination: Pagination) {
groups(pagination: $pagination) {
name
id
parent {
id
name
}
assets {
id
name
}
}
}
Example Variables
{
"pagination": {
"limit": 100,
"offset": 0
}
}