-
Notifications
You must be signed in to change notification settings - Fork 51
/
rest_proxy.yaml
819 lines (818 loc) · 26 KB
/
rest_proxy.yaml
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
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
openapi: 3.0.1
info:
title: REST Proxy API
description: >-
The Confluent REST Proxy provides a RESTful interface to a Kafka cluster, making it easy to produce and consume messages, view the state of the cluster, and perform administrative actions without using the native Kafka protocol or clients.
<p>Some example use cases are</p>
<ul>
<li>Reporting data to Kafka from any frontend app built in any language not supported by official Confluent clients</li>
<li>Ingesting messages into a stream processing framework that doesn’t yet support Kafka</li>
<li>Scripting administrative actions</li>
</ul>
version: 5.2.1
externalDocs:
description: Confluent's API Reference
url: https://docs.confluent.io/current/kafka-rest/
paths:
/topics:
get:
responses:
200:
description: successful operation
content:
application/vnd.kafka.v2+json:
schema:
type: array
items:
type: string
application/vnd.kafka.v2+xml:
schema:
type: array
items:
type: string
/topics/{topicName}:
get:
parameters:
- name: topicName
in: path
description: topic name
required: true
schema:
type: string
responses:
200:
description: successful operation
content:
application/vnd.kafka.v2+json:
schema:
$ref: '#/components/schemas/topic'
application/vnd.kafka.v2+xml:
schema:
$ref: '#/components/schemas/topic'
404:
description: Error code 40401 -- Topic not found
post:
description: post messages to a given topic
parameters:
- name: topicName
in: path
description: name of topic to produce the messages to
required: true
schema:
type: string
requestBody:
description: message(s) to produce to the given topic
required: true
content:
application/vnd.kafka.binary.v2+json:
schema:
$ref: '#/components/schemas/messages'
application/vnd.kafka.avro.v2+json:
schema:
$ref: '#/components/schemas/messages'
application/vnd.kafka.json.v2+json:
schema:
$ref: '#/components/schemas/messages'
responses:
200:
description: message(s) posted
content:
application/vnd.kafka.v2+json:
schema:
$ref: '#/components/schemas/messages_response'
404:
description: 40401 -- Topic not found
422:
description: >-
42201 -- Request includes keys and uses a format that requires schemas, but does not include the `key_schema` or `key_schema_id` fields<br>
42202 -- Request includes values and uses a format that requires schemas, but does not include the `value_schema` or `value_schema_id` fields<br>
42205 -- Request includes invalid schema.
/topics/{topicName}/partitions:
get:
description: Get a list of partitions for the topic
parameters:
- name: topicName
in: path
description: the name of the topic
required: true
schema:
type: string
responses:
200:
description: successful
content:
application/vnd.kafka.v2+json:
schema:
$ref: '#/components/schemas/partitions'
404:
description: topic not found
/topics/{topicName}/partitions/{partitionID}:
get:
description: Get metadata about a single partition in the topic
parameters:
- name: topicName
in: path
description: Name of the topic
required: true
schema:
type: string
- name: partitionID
in: path
description: ID of the partition to inspect
required: true
schema:
type: string
responses:
200:
description: successful
content:
application/vnd.kafka.v2+json:
schema:
$ref: '#/components/schemas/partitions'
post:
description: Produce messages to one partition of the topic
parameters:
- name: topicName
in: path
description: name of topic to produce the messages to
required: true
schema:
type: string
- name: partitionID
in: path
required: true
schema:
type: integer
requestBody:
description: message(s) to produce to the given topic
required: true
content:
application/vnd.kafka.v2+json:
schema:
$ref: '#/components/schemas/messages'
responses:
200:
description: message(s) posted
content:
application/vnd.kafka.v2+json:
schema:
$ref: '#/components/schemas/messages_response'
404:
description: >-
40401 -- Topic not found<br>
40402 -- Partition not found
422:
description: >-
42201 -- Request includes keys and uses a format that requires schemas, but does not include the `key_schema` or `key_schema_id` fields<br>
42202 -- Request includes values and uses a format that requires schemas, but does not include the `value_schema` or `value_schema_id` fields<br>
42205 -- Request includes invalid schema.
/consumers/{group_name}:
description: Create a new consumer instance in the consumer group
post:
parameters:
- name: group_name
in: path
required: true
schema:
type: string
requestBody:
required: true
content:
application/vnd.kafka.v2+json:
schema:
$ref: '#/components/schemas/consumer_group'
responses:
200:
description: Consumer group created
content:
application/vnd.kafka.v2+json:
schema:
type: object
properties:
instance_id:
type: string
description: Unique ID for the consumer instance in this group
base_uri:
type: string
description: Base URI used to construct URIs for subsequent requests against this consumer instance. This will be of the form `http://hostname:port/consumers/consumer_group/instances/instance_id`
409:
description: Consumer instance with the specified name already exists
422:
description: Invalid consumer configuration
/consumers/{group_name}/instances/{instance}:
description: Delete the consumer instance
delete:
parameters:
- name: group_name
in: path
required: true
schema:
type: string
description: The name of the consumer group
- name: instance
in: path
required: true
schema:
type: string
description: The ID of the consumer instance
responses:
204:
description: Success
404:
description: 40403 -- Consumer instance not found
/consumers/{group_name}/instances/{instance}/offsets:
post:
description: Commit a list of offsets for the consumer. When the post body is empty, it commits all the records that have been fetched by the consumer instance.
parameters:
- name: group_name
in: path
required: true
schema:
type: string
description: The name of the consumer group
- name: instance
in: path
required: true
schema:
type: string
description: The ID of the consumer instance
requestBody:
description: The offsets to commit
content:
application/vnd.kafka.v2+json:
schema:
$ref: '#/components/schemas/offsets'
responses:
200:
description: Success
404:
description: 40403 -- Consumer instance not found
get:
description: Get the latest committed offsets for the given partitions
parameters:
- name: group_name
in: path
required: true
schema:
type: string
description: The name of the consumer group
- name: instance
in: path
required: true
schema:
type: string
description: The ID of the consumer instance
requestBody:
required: true
content:
application/vnd.kafka.v2+json:
schema:
$ref: '#/components/schemas/offsets_query'
responses:
200:
description: Success
content:
application/vnd.kafka.v2+json:
schema:
$ref: '#/components/schemas/offsets_response'
404:
description: >-
40402 -- Partition not found<br>
40403 -- Consumer instance not found
/consumers/{group_name}/instances/{instance}/subscription:
post:
description: Subscribe to the given list of topics or a topic pattern to get dynamically assigned partition. If a prior subscription exists, it would be replaced by the latest subscription.
parameters:
- name: group_name
in: path
required: true
schema:
type: string
description: The name of the consumer group
- name: instance
in: path
required: true
schema:
type: string
description: The ID of the consumer instance
requestBody:
required: true
content:
application/vnd.kafka.v2+json:
schema:
oneOf:
- $ref: '#/components/schemas/topic_subscription'
- $ref: '#/components/schemas/topic_pattern_subscription'
responses:
404:
description: 40403 -- Consumer instance not found
409:
description: 40903 -- Subscription to topics, partitions and pattern are mutually exclusive
204:
description: Success
get:
description: Get the current subscribed list of topics
parameters:
- name: group_name
in: path
required: true
schema:
type: string
description: The name of the consumer group
- name: instance
in: path
required: true
schema:
type: string
description: The ID of the consumer instance
responses:
404:
description: 40403 -- Consumer instance not found
200:
description: Success
content:
application/vnd.kafka.v2+json:
schema:
oneOf:
- $ref: '#/components/schemas/topic_subscription'
- $ref: '#/components/schemas/topic_pattern_subscription'
delete:
description: Unsubscribe from the topics currently subscribed
parameters:
- name: group_name
in: path
required: true
schema:
type: string
description: The name of the consumer group
- name: instance
in: path
required: true
schema:
type: string
description: The ID of the consumer instance
responses:
204:
description: success
404:
description: 40403 -- Consumer instance not found
/consumers/{group_name}/instances/{instance}/assignments:
post:
description: Manually assign a list of partitions to this consumer.
parameters:
- name: group_name
in: path
required: true
schema:
type: string
description: The name of the consumer group
- name: instance
in: path
required: true
schema:
type: string
description: The ID of the consumer instance
requestBody:
required: true
content:
application/vnd.kafka.v2+json:
schema:
$ref: '#/components/schemas/assignment'
responses:
204:
description: success
404:
description: 40403 -- Consumer instance not found
409:
description: 40903 -- Subscription to topics, partitions and pattern are mutually exclusive
get:
description: Get the list of partitions currently manually assigned to this consumer
parameters:
- name: group_name
in: path
required: true
schema:
type: string
description: The name of the consumer group
- name: instance
in: path
required: true
schema:
type: string
description: The ID of the consumer instance
responses:
200:
description: Success
content:
application/vnd.kafka.v2+json:
schema:
$ref: '#/components/schemas/assignment'
/consumers/{group_name}/instances/{instance}/positions:
post:
description: Overrides the fetch offsets that the consumer will use for the next set of records to fetch
parameters:
- name: group_name
in: path
required: true
schema:
type: string
description: The name of the consumer group
- name: instance
in: path
required: true
schema:
type: string
description: The ID of the consumer instance
requestBody:
content:
application/vnd.kafka.v2+json:
schema:
type: object
properties:
offsets:
type: array
items:
type: object
properties:
topic:
type: string
partition:
type: integer
description: Partition ID
offset:
type: integer
responses:
204:
description: success
404:
description: 40403 -- Consumer instance not found
/consumers/{group_name}/instances/{instance}/beginning:
post:
description: Seek to the first offset for each of the given partitions
parameters:
- name: group_name
in: path
required: true
schema:
type: string
description: The name of the consumer group
- name: instance
in: path
required: true
schema:
type: string
description: The ID of the consumer instance
requestBody:
required: true
content:
application/vnd.kafka.v2+json:
schema:
$ref: '#/components/schemas/partition_positions'
responses:
204:
description: Success
404:
description: 40403 -- Consumer instance not found
/consumers/{group_name}/instances/{instance}/end:
post:
description: Seek to the last offset for each of the given partitions
parameters:
- name: group_name
in: path
required: true
schema:
type: string
description: The name of the consumer group
- name: instance
in: path
required: true
schema:
type: string
description: The ID of the consumer instance
requestBody:
required: true
content:
application/vnd.kafka.v2+json:
schema:
$ref: '#/components/schemas/partition_positions'
responses:
204:
description: Success
404:
description: 40403 -- Consumer instance not found
/consumers/{group_name}/instances/{instance}/records:
get:
description: Fetch data for the topics or partitions specified using one of the subscribe/assign APIs
parameters:
- name: group_name
in: path
required: true
schema:
type: string
description: The name of the consumer group
- name: instance
in: path
required: true
schema:
type: string
description: The ID of the consumer instance
- name: timeout
in: query
description: Maximum amount of milliseconds the REST proxy will spend fetching records
schema:
type: integer
- name: max_bytes
in: query
description: The maximum number of bytes of unencoded keys and values that should be included in the response
schema:
type: integer
responses:
200:
description: records back from Kafka
content:
application/vnd.kafka.binary.v2+json:
schema:
$ref: '#/components/schemas/records'
application/vnd.kafka.avro.v2+json:
schema:
$ref: '#/components/schemas/records'
application/vnd.kafka.json.v2+json:
schema:
$ref: '#/components/schemas/records'
404:
description: 40403 -- Consumer instance not found
406:
description: 40601 -- Consumer format does not match the embedded format requested by the `Accept` header
/brokers:
get:
description: Get a list of brokers
responses:
200:
description: A list of broker IDs
content:
application/vnd.kafka.v2+json:
schema:
type: object
properties:
brokers:
type: array
items:
type: integer
components:
schemas:
topic:
type: object
properties:
name:
type: string
description: Name of the topic
configs:
type: object
description: Per-topic configuration overrides
partitions:
type: array
description: List of partitions for this topic
items:
type: object
properties:
partition:
type: integer
description: the ID of this partition
leader:
type: integer
description: the broker ID of the leader for this partition
replicas:
type: array
items:
type: object
properties:
broker:
type: integer
description: broker ID of the replica
leader:
type: boolean
description: true if this replica is the leader for the partition
in_sync:
type: boolean
description: true if this replica is currently in sync with the leader
messages:
type: object
properties:
key_schema:
type: string
description: Full schema encoded as a string (e.g. JSON serioalized for Avro data)
value_schema:
type: string
description: Full schema encoded as a string (e.g. JSON serioalized for Avro data)
records:
type: array
description: a list of records to produce to the topic
items:
type: object
properties:
key:
type: string
description: The message key, formatted according to the embedded format, or null to omit a key (optional)
value:
type: string
description: The message value, formatted according to the embedded format
partion:
type: integer
description: Partition to store the message in (optional)
messages_response:
type: object
properties:
key_schema_id:
type: integer
description: The ID for the schema used to produce keys, or null if keys were not used
value_schema_id:
type: integer
description: The ID for the schema used to produce keys, or null if keys were not used
offsets:
type: array
description: List of partitions and offsets the messages were published to
items:
type: object
properties:
partition:
type: integer
description: Partition the message was published to, or null if publishing the message failed
offset:
type: integer
description: Offset of the message, or null if publishing the message failed
error_code:
type: integer
description: An error code classifying the reason the operation failed, or null if it succeeded
enum:
- 1
- 2
error:
type: string
description: An error message describing why the operation failed, or null if it succeeded
partitions:
type: array
items:
$ref: '#/components/schemas/partition'
partition:
type: object
properties:
partition:
type: integer
description: ID of the partition
leader:
type: integer
description: Broker ID of the leader for this partition
replicas:
type: array
description: List of brokers acting as replicas for this partition
items:
type: object
properties:
broker:
type: integer
description: Broker ID of the replica
leader:
type: boolean
description: true if this broker is the leader for the partition
in_sync:
type: boolean
description: true if the replica is in sync with the leader
consumer_group:
type: object
properties:
name:
type: string
description: Name for the consumer instance, which will be used in URLs for the consumer
format:
type: string
description: The format of consumed messages, which is used to convert messages into a JSON-compatible form.
enum:
- binary
- avro
- json
default: binary
auto.offset.reset:
type: string
description: sets the `auto.offset.reset` setting for the consumer
auto.commit.enable:
type: string
description: sets the `auto.commit.enable` setting for the consumer
fetch.min.bytes:
type: string
description: sets the `fetch.min.bytes` setting for this consumer specifically
consumer.request.timeout.ms:
type: string
description: sets the `consumer.request.timeout.ms` setting for this consumer specifically
offsets:
type: object
properties:
offsets:
type: array
items:
type: object
properties:
topic:
type: string
description: Name of the topic
partition:
type: integer
description: Partition ID
offset:
type: integer
description: The offset to commit
offsets_query:
type: object
properties:
partitions:
type: array
description: A list of partitions to find the last committed offsets for
items:
type: object
properties:
topic:
type: string
description: Name of the topic
partition:
type: integer
description: Partition ID
offsets_response:
type: object
properties:
offsets:
type: array
items:
type: object
properties:
topic:
type: string
description: Name of the topic
partition:
type: integer
description: Partition ID
offset:
type: integer
description: Committed offset
metadata:
type: string
description: Metadata for the committed offset
topic_subscription:
type: object
properties:
topics:
type: array
description: A list of topics to subscribe
items:
type: string
description: Name of the topic
topic_pattern_subscription:
type: object
properties:
topic_pattern:
type: string
description: A pattern of topics to subscribe to
assignment:
type: object
properties:
partitions:
type: array
items:
type: object
properties:
topic:
type: string
description: Name of the topic
partition:
type: integer
description: Partition ID
partition_positions:
type: object
properties:
partitions:
type: array
description: A list of partitions
items:
type: object
properties:
topic:
type: string
partition:
type: integer
description: Partition ID
records:
type: array
items:
type: object
properties:
topic:
type: string
description: The topic
key:
type: string
value:
type: string
partition:
type: integer
description: Partition of the message
offset:
type: integer
description: Offset of the message