Apache Geode CHANGELOG

POST /geode/v1/queries/{queryId}

Execute the specified named query passing in scalar values for query parameters in the POST body.

Resource URL

http://<hostname_or_http-service-bind-address>:<http-service-port>/geode/v1/queries/{queryId}

Parameters

Parameter Description Example Values
{queryId} QueryID for named query. selectOrders
query bind parameter values Bind parameters for the query are specified in the request body (JSON).

Specify the parameter @type and @value for each bind parameter. For example, to provide values to the following query:

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

You could pass in the following JSON in the request body as the bind parameters:

[
        {
             "@type":  "int ",
             "@value": 2
        },
        { 
            "@type":  "double ",
             "@value": 110.00
        }
]

Example Request

POST /geode/v1/queries/selectOrders
Accept: application/json
Content-Type: application/json

[
        {
             "@type":  "int ",
             "@value": 2
        },
        { 
            "@type":  "double ",
             "@value": 110.00
        }
]

Example Success Response

Response Payload: application/json

200 OK
Content-Length: <#-of-bytes>
Content-Type: application/json

[
    {
        "description":  "Purchase order for  company - B",
         "totalPrice": 350,
         "purchaseOrderNo": 1112,
         "customerId": 102,
         "deliveryDate":  "Thu Feb 20 00:00:00 IST 2014",
         "contact":  "John Doe",
         "email":  "John.Doe@pivotal.io",
         "phone":  "01-2048096",
         "items": [
            {
                 "description":  "Product-AAAA",
                 "quantity": 10,
                 "itemNo": 1,
                 "unitPrice": 20,
                 "totalPrice": 200,
                 "type-class":  "org.apache.geode.web.rest.domain.Item"
            },
            {
                 "description":  "Product-BBB",
                 "quantity": 15,
                 "itemNo": 2,
                 "unitPrice": 10,
                 "totalPrice": 150,
                 "type-class":  "org.apache.geode.web.rest.domain.Item"
            }
        ],
         "orderDate":  "Mon Feb 10 00:00:00 IST 2014",
         "type-class":  "org.apache.geode.web.rest.domain.Order"
    },
    {...},
    {...}
}

Error Codes

Status Code Description
400 BAD REQUEST JSON document in the request body (specifying query bind params) is invalid
401 UNAUTHORIZED Invalid Username or Password
403 FORBIDDEN Insufficient privileges for operation
404 NOT FOUND Query with specified ID could not be found
500 INTERNAL SERVER ERROR Encountered error at server:
  • Syntax of the OQL queryString is invalid!
  • 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 has 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!“
  • Error encountered while executing named query!”