forked from apache/geode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
get_region_data_for_multiple_keys.html.md.erb
238 lines (210 loc) · 7.04 KB
/
get_region_data_for_multiple_keys.html.md.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
---
title: GET /gemfire-api/v1/{region}/{key1},{key2},...,{keyN}
---
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
Read data for multiple keys in the region.
## Resource URL
``` pre
http://<hostname_or_http-service-bind-address>:<http-service-port>/gemfire-api/v1/queries[?ignoreMissingKey=true]
```
## Parameters
<table>
<colgroup>
<col width="33%" />
<col width="33%" />
<col width="34%" />
</colgroup>
<thead>
<tr class="header">
<th>Parameter</th>
<th>Description</th>
<th>Example Values</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>ignoreMissingKey</td>
<td><strong>Optional</strong>. Boolean to indicate whether to return non-existing keys as null responses. Use this to prevent 400 errors.</td>
<td>true
<p>false</p></td>
</tr>
</tbody>
</table>
## Example Requests
``` pre
GET /gemfire-api/v1/orders/1,2,13,4,5?ignoreMissingKey=true
Request Payload: null
Accept: application/json
GET /gemfire-api/v1/orders/1,3
Request Payload: null
Accept: application/json
```
## Example Success Responses
``` pre
Response Payload: application/json
200 OK
Server: Apache-Coyote/1.1
Content-Location: http://localhost:8080/gemfire-api/v1/orders/13,2,1,5,4
Content-Type: application/json
Transfer-Encoding: chunked
Date: Sat, 18 Jan 2014 21:39:04 GMT
{
"orders": [
null,
{
"@type": "org.apache.geode.rest.internal.web.controllers.Order",
"purchaseOrderNo": 1112,
"customerId": 102,
"description": "Purchase order for company - B",
"orderDate": "02/10/2014",
"deliveryDate": "02/20/2014",
"contact": "John Doe",
"email": "[email protected]",
"phone": "01-2048096",
"totalPrice": 350,
"items": [
{
"itemNo": 1,
"description": "Product-AAAA",
"quantity": 10,
"unitPrice": 20,
"totalPrice": 200
},
{
"itemNo": 2,
"description": "Product-BBB",
"quantity": 15,
"unitPrice": 10,
"totalPrice": 150
}
]
},
{
"@type": "org.apache.geode.rest.internal.web.controllers.Order",
"purchaseOrderNo": 11101,
"customerId": 101,
"description": "Purchase order for company - A",
"orderDate": "01/10/2014",
"deliveryDate": "01/20/2014",
"contact": "Jane Doe",
"email": "[email protected]",
"phone": "020-2048096",
"totalPrice": 205,
"items": [
{
"itemNo": 1,
"description": "Product-1",
"quantity": 5,
"unitPrice": 10,
"totalPrice": 50
},
{
"itemNo": 3,
"description": "Product-3",
"quantity": 10,
"unitPrice": 100,
"totalPrice": 1000
},
{
"itemNo": 1,
"description": "Product-2",
"quantity": 10,
"unitPrice": 15.5,
"totalPrice": 155
}
]
},
null,
null
]
}
200 OK
Server: Apache-Coyote/1.1
Content-Location: http://localhost:8080/gemfire-api/v1/orders/3,1
Content-Type: application/json
Transfer-Encoding: chunked
Date: Sat, 18 Jan 2014 21:39:04 GMT
{
"orders" : [ {
"purchaseOrderNo" : 1112,
"customerId" : 102,
"description" : "Purchase order for company - B",
"orderDate" : "02/10/2014",
"deliveryDate" : "02/20/2014",
"contact" : "John Doe",
"email" : "[email protected]",
"phone" : "01-2048096",
"items" : [ {
"itemNo" : 1,
"description" : "Product-AAAA",
"quantity" : 10,
"unitPrice" : 20.0,
"totalPrice" : 200.0
}, {
"itemNo" : 2,
"description" : "Product-BBB",
"quantity" : 15,
"unitPrice" : 10.0,
"totalPrice" : 150.0
} ],
"totalPrice" : 350.0
}, {
"purchaseOrderNo" : 111,
"customerId" : 101,
"description" : "Purchase order for company - A",
"orderDate" : "01/10/2014",
"deliveryDate" : "01/20/2014",
"contact" : "Jane Doe",
"email" : "[email protected]",
"phone" : "020-2048096",
"items" : [ {
"itemNo" : 1,
"description" : "Product-1",
"quantity" : 5,
"unitPrice" : 10.0,
"totalPrice" : 50.0
}, {
"itemNo" : 1,
"description" : "Product-2",
"quantity" : 10,
"unitPrice" : 15.5,
"totalPrice" : 155.0
} ],
"totalPrice" : 205.0
} ]
}
```
## Error Codes
| Status Code | Description |
|-----------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 400 BAD REQUEST | Returned if one or more of the supplied keys is not found in the region and ignoreMissingKey=false (default if parameter is not specified); returned if the specified value for the ignoreMissingKey parameter is a value other than 'true' or 'false'. |
| 404 NOT FOUND | If the specified region does not exist. |
## Example Error Response
``` pre
GET /gemfire-api/v1/orders/1,2,13,4,5
Request Payload: null
Accept: application/json
Response Payload: application/json
400 BAD_REQUEST
Server: Apache-Coyote/1.1
Content-Type: application/json
Content-Length: 51
Date: Wed, 21 May 2014 11:24:00 GMT
Connection: close
"Requested keys [13,4,5] not exist in region [orders]"
```
## Implementation Notes
The response body sets the region name as key to the array of values. For example "orders" : <VALUE\_ARRAY>.