This is an old revision of the document!
Example Queries
Below are some example GraphQL queries that retrieve ARDI data.
Query by ID Number
The following query gets the ID number and name of the ARDI asset with the ID '44'.
query {
asset(id: 44) {
id
name
}
}
Query by Name/ERN/Code
The following query gets the ID number and name of the ARDI asset with the name, equipment reference number or code 'AR925'.
query {
asset(name: "AR925") {
id
name
}
}
Query by Type
The following query gets a list of all pumps in the system.
query {
pump {
id
name
}
}
Query Base Assets
If you want to query the base of a hierarchy or the origin points/source of relationships, you can use the relationship name.
query {
power {
name
}
}
This creates a list of the items that are a source of electrical power.
Get a List of Available Properties
To get a list of the properties available on an asset (or assets), use the properties value.
query {
asset(name: "AR925") {
id
name
properties
}
}
Get a List of Directly Connected Items
To get a list of the items inside an item (meaning assets under the given asset via the Location relationship), you can use the following…
query {
asset(name: "AR925") {
id
name
inside {
id
name
temperature
}
}
}
Note that you can have a different set of attributes on the item inside.
Get a List of All Connected Items
To get a list all of the items down or upstream from an asset (in this example, the power relationship) you can use the following…
query {
asset(name: "AR925") {
id
name
allPoweredBy {
id
name
temperature
}
}
}
In this case poweredBy lists the directly connected assets, and allPoweredBy lists all of the indirectly connected assets..
Get a Nested List of All Connected Items
The above query runs very quickly, but while the results include every down-stream item, the details of the connections between them are lost.
If you're trying to keep some information explaining how the various parts are connected, you can use a trick we've added.
If you ask for related items but do not include any query details (for example, you don't name the individual columns you want returned), it will use the details of the parent query again. This lets you make a 'loop' that will run through your relationships and hierarchies.
query {
asset(name: "AR925") {
id
name
poweredBy
}
}
Requesting History
If you want to get history of the values you're asking for, you can use from, to and samples parameters.
query {
asset(name: "AR925", from: "2025-10-10 10:00:00", to: "2025-10-11 10:00:00", samples: 1000) {
id
name
temperature
}
}
The above example will load roughly 1000 samples of data on the temperature of asset AR925
Requesting Relative History
If you want to get history but want it to be relative to the current time (for example, the last 24 hours) you can use the range and samples parameters.
query {
asset(name: "AR925", range: "24 hours", samples: 100) {
id
name
temperature
}
}
The above example will load roughly 100 samples of data covering the previous 24 hours.