GET /topics/{topic:string}/partitions

Retrieves a list of partitions for the 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 Gets metadata about specific MapR Streams partitions within a topic. The user could pass fully qualified topic name or not. If a fully qualified topic name is not used, metadata is retrieved and appended to the default stream path.
streams.default.stream is not defined and rest.proxy.backend=streams Gets metadata about specific MapR Streams partitions within 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

Gets metadata about partitions within specific MapR Streams topic if topic name starts with a backslash (/) and a colon (:). Otherwise, gets metadata about partitions within a Apache Kafka topic.

Table 2. Parameters
Parameters Description
topic_name (string) Name of the topic.

Syntax

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

Request Example

curl -X GET "http://localhost:8082/topics/testtopic1/partitions"

Response Example

The following response example returns a topic with two partitions.

[
  {
    "partition":0,
    "leader":0,
    "replicas":
      [{
          "broker":0,
          "leader":true,
          "in_sync":true
        }]
  },
  {
    "partition":1,
    "leader":0,
    "replicas":
      [{
          "broker":0,
          "leader":true,
          "in_sync":true
         }]
  }
]