Pulsar REST

To connect to Pulsar, you need to specify a URL.

  • Produce messages to non-partitioned or partitioned topics

  • Produce messages to specific partitions of partitioned topics

Producer

Currently, you can produce messages to the following destinations with tools like cURL or Postman via REST.

note

You can only produce messages to topics that already exist in Pulsar via REST.

Consuming and reading messages via REST will be supported in the future.

  • Below is the structure of a request payload.

  • ParameterRequired?TypeDescription
    YesStringActual message payload

    Messages are sent in strings and encoded with given schemas on the server side
    propertiesNoMap<String, String>Custom properties
    keyNoStringPartition key
    replicationClustersNoList<String>Clusters to which messages replicate
    NoStringMessage event time
    sequenceIdNolongMessage sequence ID
    disableReplicationNobooleanWhether to disable replication of messages
    deliverAtNolongDeliver messages only at or after specified absolute timestamp
    NolongDeliver messages only after specified relative delay (in milliseconds)
  • Currently, Primitive, Avro, JSON, and KeyValue schemas are supported.

  • For Primitive, Avro and JSON schemas, schemas should be provided as the full schema encoded as a string.

Below is an example of sending messages to topics using JSON schema via REST.

Send messages to topics with JSON schema using the command below.