You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/en/connector-v2/source/Http.md
+152-8
Original file line number
Diff line number
Diff line change
@@ -51,7 +51,8 @@ They can be downloaded via install-plugin.sh or from the Maven central repositor
51
51
| schema.fields | Config | No | - | The schema fields of upstream data |
52
52
| json_field | Config | No | - | This parameter helps you configure the schema,so this parameter must be used with schema. |
53
53
| pageing | Config | No | - | This parameter is used for paging queries |
54
-
| pageing.page_field | String | No | - | This parameter is used to specify the page field name in the request parameter |
54
+
| pageing.page_field | String | No | - | This parameter is used to specify the page field name in the request. It can be used in headers, params, or body with placeholders like ${page_field}. |
55
+
| pageing.use_placeholder_replacement | Boolean | No | false | If true, use placeholder replacement (${field}) for headers, parameters and body values, otherwise use key-based replacement. |
55
56
| pageing.total_page_size | Int | No | - | This parameter is used to control the total number of pages |
56
57
| pageing.batch_size | Int | No | - | The batch size returned per request is used to determine whether to continue when the total number of pages is unknown |
57
58
| pageing.start_page_number | Int | No | 1 | Specify the page number from which synchronization starts |
@@ -215,7 +216,7 @@ By default, the parameters will be added to the url path.
215
216
If you need to keep the old version behavior, please check keep_params_as_form.
216
217
217
218
### body
218
-
The HTTP body is used to carry the actual data in requests or responses, including JSON, form submissions.
219
+
The HTTP body is used to carry the actual data in requests or responses, including JSON, form submissions.
219
220
220
221
The reference format is as follows:
221
222
```hocon
@@ -311,7 +312,7 @@ This parameter helps you configure the schema,so this parameter must be used wit
311
312
If your data looks something like this:
312
313
313
314
```json
314
-
{
315
+
{
315
316
"store": {
316
317
"book": [
317
318
{
@@ -366,14 +367,25 @@ source {
366
367
- See this link for task configuration [http_jsonpath_to_assert.conf](../../../../seatunnel-e2e/seatunnel-connector-v2-e2e/connector-http-e2e/src/test/resources/http_jsonpath_to_assert.conf).
367
368
368
369
### pageing
369
-
The current supported pagination type are `PageNumber` and `Cursor`.
370
+
The current supported pagination type are `PageNumber` and `Cursor`.
370
371
if you need to use pagination, you need to configure `pageing`. the default pagination type is `PageNumber`.
371
372
372
373
373
374
#### 1. PageNumber
374
-
When you need to concatenate page param in the URL,then add params.
375
-
When you need to set page param to the body,add the key of page param in body.
375
+
When using `PageNumber` pagination, you can include page parameters in different parts of your HTTP request:
376
+
377
+
-**In URL parameters**: Add the page parameter to the `params` section
378
+
-**In request body**: Include the page parameter in the `body` JSON
379
+
-**In headers**: Add the page parameter to the `headers` section
380
+
381
+
You can use placeholders like `${page}` with `use_placeholder_replacement = true` to dynamically update these values. The placeholders can be used in various formats:
382
+
383
+
- As a standalone value: `"${page}"`
384
+
- With prefix/suffix: `"10${page}"` or `"page-${page}"`
385
+
- As a number without quotes: `${page}` (in JSON body)
386
+
- In nested JSON structures: `{"pagination":{"page":${page}}}`
376
387
388
+
##### Example 1: Using page parameters in body and params
377
389
378
390
```hocon
379
391
source {
@@ -391,6 +403,7 @@ source {
391
403
page_type="PageNumber"
392
404
total_page_size=20
393
405
page_field=page
406
+
use_placeholder_replacement=true
394
407
#when don't know the total_page_size use batch_size if read size<batch_size finish ,otherwise continue
395
408
#batch_size=10
396
409
}
@@ -402,9 +415,140 @@ source {
402
415
}
403
416
}
404
417
}
418
+
```
419
+
420
+
##### Example 2: Using page parameters in headers
421
+
422
+
```hocon
423
+
source {
424
+
Http {
425
+
url = "http://localhost:8080/mock/queryData"
426
+
method = "GET"
427
+
format = "json"
428
+
headers={
429
+
Page-Number = "${pageNo}"
430
+
Authorization = "Bearer token-123"
431
+
}
432
+
pageing={
433
+
page_field = pageNo
434
+
start_page_number = 1
435
+
batch_size = 10
436
+
use_placeholder_replacement = true
437
+
}
438
+
schema = {
439
+
fields {
440
+
name = string
441
+
age = string
442
+
}
443
+
}
444
+
}
445
+
}
446
+
```
447
+
448
+
##### Example 3: Using key-based replacement (without placeholders)
449
+
450
+
```hocon
451
+
source {
452
+
Http {
453
+
url = "http://localhost:8080/mock/queryData"
454
+
method = "GET"
455
+
format = "json"
456
+
params={
457
+
page = "1"
458
+
}
459
+
pageing={
460
+
page_field = page
461
+
start_page_number = 1
462
+
batch_size = 10
463
+
use_placeholder_replacement = false
464
+
}
465
+
schema = {
466
+
fields {
467
+
name = string
468
+
age = string
469
+
}
470
+
}
471
+
}
472
+
}
473
+
```
405
474
475
+
##### Example 4: Using prefixed page number in headers
406
476
407
-
```
477
+
```hocon
478
+
source {
479
+
Http {
480
+
url = "http://localhost:8080/mock/queryData"
481
+
method = "GET"
482
+
format = "json"
483
+
headers = {
484
+
Page-Number = "10${page}" # Will become "105" when page=5
485
+
Authorization = "Bearer token-123"
486
+
}
487
+
pageing = {
488
+
page_field = page
489
+
start_page_number = 5
490
+
batch_size = 10
491
+
use_placeholder_replacement = true
492
+
}
493
+
schema = {
494
+
fields {
495
+
name = string
496
+
age = string
497
+
}
498
+
}
499
+
}
500
+
}
501
+
```
502
+
503
+
##### Example 5: Using unquoted page number in body
504
+
505
+
```hocon
506
+
source {
507
+
Http {
508
+
url = "http://localhost:8080/mock/queryData"
509
+
method = "POST"
510
+
format = "json"
511
+
body = """{"a":${page},"limit":10}""" # Unquoted number
512
+
pageing = {
513
+
page_field = page
514
+
start_page_number = 1
515
+
batch_size = 10
516
+
use_placeholder_replacement = true
517
+
}
518
+
schema = {
519
+
fields {
520
+
name = string
521
+
age = string
522
+
}
523
+
}
524
+
}
525
+
}
526
+
```
527
+
528
+
##### Example 6: Using nested JSON structure with page parameter
529
+
530
+
```hocon
531
+
source {
532
+
Http {
533
+
url = "http://localhost:8080/mock/queryData"
534
+
method = "POST"
535
+
format = "json"
536
+
body = """{"pagination":{"page":${page},"size":10},"filters":{"active":true}}""" # Nested structure
537
+
pageing = {
538
+
page_field = page
539
+
start_page_number = 1
540
+
total_page_size = 20
541
+
use_placeholder_replacement = true
542
+
}
543
+
schema = {
544
+
fields {
545
+
name = string
546
+
age = string
547
+
}
548
+
}
549
+
}
550
+
}
551
+
```
408
552
409
553
#### 2. Cursor
410
554
the `pageing.page_type` parameter must be set to `Cursor`.
0 commit comments