Skip to main content

GET /geode/v1/queries/adhoc?q=<OQL-statement>

Run an unnamed (unidentified), ad-hoc query passed as a URL parameter.

Resource URL

http://<hostname_or_http-service-bind-address>:<http-service-port>/geode/v1/queries/adhoc?q=<OQL-statement>

Parameters

ParameterDescriptionExample Values
qRequired. OQL query statement.

Note: Because the query is passed in the URL, it must be URL-encoded. Some HTTP clients (like web browsers) do this automatically. Otherwise, you must encode it manually.
SELECT o FROM /orders o WHERE o.quantity > 2 AND o.totalprice > 110.00

URL-encoded: SELECT%20o%20FROM%20%2Forders%20o%20WHERE%20o.quantity%20%3E%202%20AND%20o.totalprice%20%3E%20110.00

SELECT * FROM /customers

URL-encoded: SELECT%20*%20FROM%20%2Fcustomers

Example Request

curl -i "http://localhost:8080/geode/v1/queries/adhoc?q=select%20*%20%20from%20/customers"

Example Success Response

Response Payload: application/json

200 OK
Content-Length: <#-of-bytes>
Content-Type: application/json
[
{
"firstName": "John",
"lastName": "Doe",
"customerId": 101,
},
{
"firstName": "Jane",
"lastName": "Doe",
"customerId": 102,
},
{
....
}
]

Error Codes

Status CodeDescription
401 UNAUTHORIZEDInvalid username or password
403 FORBIDDENInsufficient privileges for the operation
500 INTERNAL SERVER ERRORError encountered on the server. Check the HTTP response body for a stack trace. Possible causes include:

• A function was applied to an improper parameter
• Bind parameter is not of the expected type
• Name in the query cannot be resolved
• Number of bound parameters does not match the placeholders
• Query is not permitted on this region type
• Query exceeded gemfire.Cache.MAX_QUERY_EXECUTION_TIME
• Data in the FROM clause is not available for querying
• Query canceled due to low memory (critical heap reached)
• Server error while executing an ad hoc query