GQL Resource
This resource executes a GS SQL statement and returns the results.
It is not api_key compatible because GS SQL execution requires running under a user so that results are filtered by content store permissions.
GET gql
Executes
a GS SQL statement and returns the
results. |
Resource Information | |
Rate Limited? | Yes | |
session, oauth and org tokens compatible? | Yes | |
api_key compatible? | No | |
Resource URL
http://grovestreams.com/api/gql
Parameters
s | required |
The URL encoded GS SQL statement. |
tz | optional |
The time
zone id to use if the SQL returns dynamic rolllup samples or if
any date functions do not include a time zone id. |
h | optional |
true/false. Defaults to false. Indicates if the result contains the header. Only applies to compact (c=true) queries. |
c | optional |
true/false. Defaults to false. Indicates if the result is returned in a JSON compact format. |
Example Requests
Request
Execute the following GS SQL statement. Return column headers. Return compact format. Notice that the GS SQL is encoded:
Select cname, name, folderPath from Stream Where StartsWith(folderPath, '/Components')
gql?org=00000000-0000-0000-0000-000000000001&c=true&h=true&tz=US%2FCentral&s=select%20cname%2C%20name%2C%20folderPath%20from%20stream%20where%20StartsWith(folderPath%2C%20%27%2FComponents%27)
Response Body
{
"success": true,
"message": "",
"cols": [
{
"valueType": "STRING",
"name": "cname"
},
{
"valueType": "STRING",
"name": "name"
},
{
"valueType": "STRING",
"name": "folderPath"
}
],
"rows": [
[
"Refrigerator Smart Plug Sensor",
"Ongoing Monthly Cost (Euros)",
"/Components"
],
[
"Refrigerator Smart Plug Sensor",
"cost - dollars",
"/Components"
],
[
"Refrigerator Smart Plug Sensor",
"current - rolling 3pt avg",
"/Components"
],
[
"Refrigerator Smart Plug Sensor",
"current",
"/Components"
],
[
"Garage Temperature and Light Sensor",
"light",
"/Components"
],
[
"Garage Temperature and Light Sensor",
"low_battery",
"/Components"
]
]
}
Request
Execute the following GS SQL statement. Return not in the compact format. Notice that the GS SQL is encoded:
select cname, name, folderPath from stream where StartsWith(folderPath, '/Components') order by cname limit 3
gql?org=00000000-0000-0000-0000-000000000001&c=false&h=true&tz=US%2FCentral&s=select%20 cname%2C%20name%2C%20folderPath%20from%20stream%20where%20StartsWith(folderPath%2C%20%27%2FComponents%27)%20order%20by%20cname%20limit%203&_dc=1648578504815
Response Body
{
"success": true,
"message": "",
"rows": [
{
"folderPath": "/Components",
"cname": "Currency Exchange Rates",
"name": "EUR/USD Conversion Rate"
},
{
"folderPath": "/Components",
"cname": "Garage Temperature and Light Sensor",
"name": "light"
},
{
"folderPath": "/Components",
"cname": "Garage Temperature and Light Sensor",
"name": "low_battery"
}
]
}