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

Parameter Description Example Values
q Required. OQL query statement.
**Note:**

Since the query string is passed in the URL, the OQL must be URL-encoded. Some HTTP clients such as Web browsers will automatically encode URLs; however, if you are not using one of those clients, you will need to URL encode the query string yourself.

SELECT o FROM /orders o WHERE o.quantity > 2 AND o.totalprice > 110.00

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

SELECT * FROM /customers

(or URL encoded: SELECT%20*%20FROM%20/customers)

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 Code Description
401 UNAUTHORIZED Invalid Username or Password
403 FORBIDDEN Insufficient privileges for operation
500 INTERNAL SERVER ERROR Error encountered at Tanzu GemFire server. Check the HTTP response body for a stack trace of the exception. Some possible exceptions include:
  • A function was applied to a parameter that is improper for that function!
  • Bind parameter is not of the expected type!
  • Name in the query cannot be resolved!
  • The number of bound parameters does not match the number of placeholders!
  • Query is not permitted on this type of region!
  • Query execution time is exceeded max query execution time (gemfire.Cache.MAX_QUERY_EXECUTION_TIME) configured!
  • Data referenced in from clause is not available for querying!
  • Query execution gets canceled due to low memory conditions and the resource manager critical heap percentage has been set!
  • Server has encountered an error while executing Adhoc query!
check-circle-line exclamation-circle-line close-line
Scroll to top icon