0
# HTTP Operations
1
2
Core HTTP request methods providing direct access to common REST operations with support for path parameters, query parameters, and URI-based requests.
3
4
## Capabilities
5
6
### GET Requests
7
8
Performs HTTP GET requests for retrieving data from REST endpoints.
9
10
```java { .api }
11
/**
12
* Perform a GET request to a path with optional path parameters
13
* @param path The path to send the request to
14
* @param pathParams Path parameters for template substitution
15
* @return The HTTP response
16
*/
17
static Response get(String path, Object... pathParams);
18
19
/**
20
* Perform a GET request to a path with path parameters as a Map
21
* @param path The path to send the request to
22
* @param pathParams Path parameters map
23
* @return The HTTP response
24
*/
25
static Response get(String path, Map<String, ?> pathParams);
26
27
/**
28
* Perform a GET request to a URI
29
* @param uri The complete URI to send the request to
30
* @return The HTTP response
31
*/
32
static Response get(URI uri);
33
34
/**
35
* Perform a GET request to a URL
36
* @param url The complete URL to send the request to
37
* @return The HTTP response
38
*/
39
static Response get(URL url);
40
41
/**
42
* Perform a GET request to the configured base URI/port
43
* @return The HTTP response
44
*/
45
static Response get();
46
```
47
48
**Usage Examples:**
49
50
```java
51
// Basic GET request
52
Response response = get("/users/123");
53
54
// GET with path parameters
55
Response response = get("/users/{id}/posts/{postId}", 123, 456);
56
57
// GET with path parameters map
58
Map<String, Object> params = new HashMap<>();
59
params.put("userId", 123);
60
params.put("postId", 456);
61
Response response = get("/users/{userId}/posts/{postId}", params);
62
63
// GET with complete URI
64
Response response = get(URI.create("https://api.example.com/users"));
65
```
66
67
### POST Requests
68
69
Performs HTTP POST requests for creating new resources.
70
71
```java { .api }
72
/**
73
* Perform a POST request to a path with optional path parameters
74
* @param path The path to send the request to
75
* @param pathParams Path parameters for template substitution
76
* @return The HTTP response
77
*/
78
static Response post(String path, Object... pathParams);
79
80
/**
81
* Perform a POST request to a path with path parameters as a Map
82
* @param path The path to send the request to
83
* @param pathParams Path parameters map
84
* @return The HTTP response
85
*/
86
static Response post(String path, Map<String, ?> pathParams);
87
88
/**
89
* Perform a POST request to a URI
90
* @param uri The complete URI to send the request to
91
* @return The HTTP response
92
*/
93
static Response post(URI uri);
94
95
/**
96
* Perform a POST request to a URL
97
* @param url The complete URL to send the request to
98
* @return The HTTP response
99
*/
100
static Response post(URL url);
101
102
/**
103
* Perform a POST request to the configured base URI/port
104
* @return The HTTP response
105
*/
106
static Response post();
107
```
108
109
### PUT Requests
110
111
Performs HTTP PUT requests for updating existing resources.
112
113
```java { .api }
114
/**
115
* Perform a PUT request to a path with optional path parameters
116
* @param path The path to send the request to
117
* @param pathParams Path parameters for template substitution
118
* @return The HTTP response
119
*/
120
static Response put(String path, Object... pathParams);
121
122
/**
123
* Perform a PUT request to a path with path parameters as a Map
124
* @param path The path to send the request to
125
* @param pathParams Path parameters map
126
* @return The HTTP response
127
*/
128
static Response put(String path, Map<String, ?> pathParams);
129
130
/**
131
* Perform a PUT request to a URI
132
* @param uri The complete URI to send the request to
133
* @return The HTTP response
134
*/
135
static Response put(URI uri);
136
137
/**
138
* Perform a PUT request to a URL
139
* @param url The complete URL to send the request to
140
* @return The HTTP response
141
*/
142
static Response put(URL url);
143
144
/**
145
* Perform a PUT request to the configured base URI/port
146
* @return The HTTP response
147
*/
148
static Response put();
149
```
150
151
### DELETE Requests
152
153
Performs HTTP DELETE requests for removing resources.
154
155
```java { .api }
156
/**
157
* Perform a DELETE request to a path with optional path parameters
158
* @param path The path to send the request to
159
* @param pathParams Path parameters for template substitution
160
* @return The HTTP response
161
*/
162
static Response delete(String path, Object... pathParams);
163
164
/**
165
* Perform a DELETE request to a path with path parameters as a Map
166
* @param path The path to send the request to
167
* @param pathParams Path parameters map
168
* @return The HTTP response
169
*/
170
static Response delete(String path, Map<String, ?> pathParams);
171
172
/**
173
* Perform a DELETE request to a URI
174
* @param uri The complete URI to send the request to
175
* @return The HTTP response
176
*/
177
static Response delete(URI uri);
178
179
/**
180
* Perform a DELETE request to a URL
181
* @param url The complete URL to send the request to
182
* @return The HTTP response
183
*/
184
static Response delete(URL url);
185
186
/**
187
* Perform a DELETE request to the configured base URI/port
188
* @return The HTTP response
189
*/
190
static Response delete();
191
```
192
193
### HEAD Requests
194
195
Performs HTTP HEAD requests for retrieving headers without response body.
196
197
```java { .api }
198
/**
199
* Perform a HEAD request to a path with optional path parameters
200
* @param path The path to send the request to
201
* @param pathParams Path parameters for template substitution
202
* @return The HTTP response
203
*/
204
static Response head(String path, Object... pathParams);
205
206
/**
207
* Perform a HEAD request to a path with path parameters as a Map
208
* @param path The path to send the request to
209
* @param pathParams Path parameters map
210
* @return The HTTP response
211
*/
212
static Response head(String path, Map<String, ?> pathParams);
213
214
/**
215
* Perform a HEAD request to a URI
216
* @param uri The complete URI to send the request to
217
* @return The HTTP response
218
*/
219
static Response head(URI uri);
220
221
/**
222
* Perform a HEAD request to a URL
223
* @param url The complete URL to send the request to
224
* @return The HTTP response
225
*/
226
static Response head(URL url);
227
228
/**
229
* Perform a HEAD request to the configured base URI/port
230
* @return The HTTP response
231
*/
232
static Response head();
233
```
234
235
### PATCH Requests
236
237
Performs HTTP PATCH requests for partial resource updates.
238
239
```java { .api }
240
/**
241
* Perform a PATCH request to a path with optional path parameters
242
* @param path The path to send the request to
243
* @param pathParams Path parameters for template substitution
244
* @return The HTTP response
245
*/
246
static Response patch(String path, Object... pathParams);
247
248
/**
249
* Perform a PATCH request to a path with path parameters as a Map
250
* @param path The path to send the request to
251
* @param pathParams Path parameters map
252
* @return The HTTP response
253
*/
254
static Response patch(String path, Map<String, ?> pathParams);
255
256
/**
257
* Perform a PATCH request to a URI
258
* @param uri The complete URI to send the request to
259
* @return The HTTP response
260
*/
261
static Response patch(URI uri);
262
263
/**
264
* Perform a PATCH request to a URL
265
* @param url The complete URL to send the request to
266
* @return The HTTP response
267
*/
268
static Response patch(URL url);
269
270
/**
271
* Perform a PATCH request to the configured base URI/port
272
* @return The HTTP response
273
*/
274
static Response patch();
275
```
276
277
### OPTIONS Requests
278
279
Performs HTTP OPTIONS requests for discovering allowed methods and CORS information.
280
281
```java { .api }
282
/**
283
* Perform an OPTIONS request to a path with optional path parameters
284
* @param path The path to send the request to
285
* @param pathParams Path parameters for template substitution
286
* @return The HTTP response
287
*/
288
static Response options(String path, Object... pathParams);
289
290
/**
291
* Perform an OPTIONS request to a path with path parameters as a Map
292
* @param path The path to send the request to
293
* @param pathParams Path parameters map
294
* @return The HTTP response
295
*/
296
static Response options(String path, Map<String, ?> pathParams);
297
298
/**
299
* Perform an OPTIONS request to a URI
300
* @param uri The complete URI to send the request to
301
* @return The HTTP response
302
*/
303
static Response options(URI uri);
304
305
/**
306
* Perform an OPTIONS request to a URL
307
* @param url The complete URL to send the request to
308
* @return The HTTP response
309
*/
310
static Response options(URL url);
311
312
/**
313
* Perform an OPTIONS request to the configured base URI/port
314
* @return The HTTP response
315
*/
316
static Response options();
317
```
318
319
### Custom HTTP Methods
320
321
Performs HTTP requests with custom or non-standard HTTP methods.
322
323
```java { .api }
324
/**
325
* Perform a request with a specific HTTP method
326
* @param method The HTTP method to use
327
* @param path The path to send the request to
328
* @param pathParams Path parameters for template substitution
329
* @return The HTTP response
330
*/
331
static Response request(Method method, String path, Object... pathParams);
332
333
/**
334
* Perform a request with a custom HTTP method string
335
* @param method The HTTP method name as string
336
* @param path The path to send the request to
337
* @param pathParams Path parameters for template substitution
338
* @return The HTTP response
339
*/
340
static Response request(String method, String path, Object... pathParams);
341
342
/**
343
* Perform a request with a specific HTTP method to a URI
344
* @param method The HTTP method to use
345
* @param uri The complete URI to send the request to
346
* @return The HTTP response
347
*/
348
static Response request(Method method, URI uri);
349
350
/**
351
* Perform a request with a specific HTTP method to a URL
352
* @param method The HTTP method to use
353
* @param url The complete URL to send the request to
354
* @return The HTTP response
355
*/
356
static Response request(Method method, URL url);
357
358
/**
359
* Perform a request with a custom HTTP method string to a URI
360
* @param method The HTTP method name as string
361
* @param uri The complete URI to send the request to
362
* @return The HTTP response
363
*/
364
static Response request(String method, URI uri);
365
366
/**
367
* Perform a request with a custom HTTP method string to a URL
368
* @param method The HTTP method name as string
369
* @param url The complete URL to send the request to
370
* @return The HTTP response
371
*/
372
static Response request(String method, URL url);
373
374
/**
375
* Perform a request with a specific HTTP method to configured base URI/port
376
* @param method The HTTP method to use
377
* @return The HTTP response
378
*/
379
static Response request(Method method);
380
381
/**
382
* Perform a request with a custom HTTP method string to configured base URI/port
383
* @param method The HTTP method name as string
384
* @return The HTTP response
385
*/
386
static Response request(String method);
387
```
388
389
**Usage Examples:**
390
391
```java
392
// Custom HTTP method using Method enum
393
Response response = request(Method.TRACE, "/debug");
394
395
// Custom HTTP method using string
396
Response response = request("CUSTOM", "/api/custom-endpoint");
397
398
// WebDAV methods
399
Response response = request("PROPFIND", "/webdav/folder");
400
Response response = request("MKCOL", "/webdav/new-collection");
401
```
402
403
## Types
404
405
```java { .api }
406
// HTTP method enumeration
407
enum Method {
408
GET, POST, PUT, DELETE, HEAD, PATCH, OPTIONS, TRACE
409
}
410
```