POST /topics/{topic: string}/partitions/{partition_id: string}

Produces messages into a partition of a topic.

Description

Depending on the configuration, the type of information retrieved has different behavior. See the streams.default.stream and rest.proxy.backend parameters in Configuration Parameters.

Table 1. Response Behavior
Parameters Defined Response
streams.default.stream is defined Produces messages into a partition of MapR Streams topic. The user could pass fully qualified topic name or not. If a fully qualified topic name is not used, messages are produced into topics in the default stream path.
streams.default.stream is not defined and rest.proxy.backend=streams Produces messages into a partition within MapR Streams topic. The user could only pass fully qualified topic name that contains stream path.
streams.default.stream is not defined and rest.proxy.backend=hybrid Produces messages into a partition within MapR Streams topic if the topic name starts with ‘/’ and contains ‘:’. Otherwise, produces messages into a specific partition within a Apache Kafka topic.
Table 2. Parameters
Parameters Description
topic_name (string) Topic to produce the messages to.
partition_id (int) Partition to produce the messages to.

Syntax

http://<host>:8082/topics/<topic_name>/partitions/<partition_id>

Request Example

curl -X GET "http://localhost:8082/topics/testtopic1/partitions/0/messages?offset=2&count=1"
      

Response Example

[{
  "key":"a2v5",
  "value":"Y29uZmx1ZW50",
  "topic":"/streaming_data/stream:testtopic1",
  "partition":0,
  "offset":2
}]