This topic describes the POST command in VMware Tanzu GemFire to execute the specified named query passing in scalar values for query parameters in the POST body.
http://<hostname_or_http-service-bind-address>:<http-service-port>/gemfire-api/v1/queries/{queryId}
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: You could pass in the following JSON in the request body as the bind parameters:
|
POST /gemfire-api/v1/queries/selectOrders
Accept: application/json
Content-Type: application/json
[
{
"@type": "int ",
"@value": 2
},
{
"@type": "double ",
"@value": 110.00
}
]
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 2020",
"contact": "John Doe",
"email": "[email protected]",
"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 2020",
"type-class": "org.apache.geode.web.rest.domain.Order"
},
{...},
{...}
}
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:
|