Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The REST Proxy is a separate server, sitting between Kafka cluster and client applications. It is wrapper around existing client libraries. 
Request/Responses supports JSON format with embedded data format (JSON and Base64 encoded strings). Proxy uses vendor specific

...

This will be taken up as future work after the KIP-4 implementation.

Public Interfaces

Producer APIs:

POST /topics/:topic

Description : Produce messages to a given topic

Parameters:
    Topic (String) - topic name

Request:
   JSON Object contains array of produce records

Response:
    JSON Object contains response objects

Status Codes:
    404 Not Found
         Error Code 40401 - topic Not Found
         Error Code 40402 - Version Not Found
   500 Internal Server Error
        Error Code 50001 - Kafka Error

 

Example request:

POST /topics/test HTTP/1.1

Host:kafkarest.host.com

Content-Type: application/vnd.kafka.binary.v1+json

Accept: application/vnd.kafka.v1+json

{

 "records": [

   {

     "key": "a2V5",

     "value": "dmFsdWU="

   },

   {

     "value": "dmFsdWU=",

     "partition": 1

   }

 ]

}

 

Example response:

HTTP/1.1 200 OK

Content-Type: application/vnd.kafka.v1+json


{

 "offsets": [

   {

     "partition": 2,

     "offset": 100

   },

   {

     "partition": 1,

     "offset": 101

   }

 ]

}

 

POST /topics/:topicName/partitions/:partition
Description : Produce messages to one partition of the topic


Parameters:
     topicName (String) - topic name
     partition (int) - partition number

Request:
    JSON Object contains array of produce records

Response:
    JSON Object contains response objects

Status Codes:
      404 Not Found
           Error Code 40401 - topic Not Found
           Error Code 40402 - partition Not Found
     500 Internal Server Error
          Error Code 50001 - Kafka Error

Example request:

POST /topics/test/partitions/1 HTTP/1.1

Host:kafkarest.host.com

Content-Type: application/vnd.kafka.binary.v1+json

Accept: application/vnd.kafka.v1+json

{

  "records": [

   {

     "key": "a2V5",

     "value": "dmFsdWU="

   },

   {

     "value": "dmFsdWU="

   }

 ]

}


Example response:

HTTP/1.1 200 OK

 Content-Type: application/vnd.kafka.v1+json


{

 "offsets": [

   {

     "partition": 1,

     "offset": 100,

   },

   {

     "partition": 1,

     "offset": 101,

   }

 ]

}

 

 

Compatibility, Deprecation, and Migration Plan

...