====Making an AQL Query====
ARDI uses its own query language named AQL to ask for information.
It returns JSON information that you should be able to use in a variety of applications.
When you're asking for historical information (using the AQL **GETHISTORY** function for example), there are also special functions to return a [[complete dataframe]] of that information in Pandas. Read up on [[reading_historical_data|reading historical data]] for more information.
===Creating a Query===
Once you're connected to the ARDI server, you'll need to create an AQLQuery
query = ardi.AQLQuery(server)
===Executing the Query===
You execute the query using the [[AQLQuery_Execute|Execute]] function, passing the actual AQL query you'd like to run.
The response comes back as a parsed JSON object.
query = ardi.AQLQuery(server)
===Process the Response===
Now you can process the response however you like.
In the example below, send a query asking for //every point that uses the property 'Temperature'//.
We then go through that list and display each of those temperatures.
===Complete Code===
import ardi
import sys
#Setup ARDI Connection
svr = ardi.Server("localhost","cr")
#Connect to ARDI Server
connected = False
try:
connected = svr.Connect()
except:
pass
if connected == False:
print("Unable to Connect to ARDI Server")
sys.exit(-1)
query = ardi.AQLQuery(svr)
data = query.Execute("'Temperature' PROPERTY ALLPOINTS")
for r in data['results'][0]['value']:
print(r['name'] + " " + r['propname'] + ": " + str(r['value']))