POST /v3/clusters/{string: cluster_Id}/topics

Creates a new topic on the specific cluster.

Description

The behavior of the information retrieved depends on the configuration. See streams.default.stream in Configuration Parameters
Table 1. Response Behavior
Parameters Defined Response
streams.default.stream is defined Creates a topic in the default stream and returns its metadata.
streams.default.stream is not defined Returns {"error_code":80001,"message":"HPE Ezmeral Data Fabric Event Data Streams does not currently support this API. Set the streams.default.stream parameter to return topics for the default stream"}.
Table 2. Parameters
Parameters Description
cluster_id (string) Cluster’s id.

Syntax

http://<host>:8082/v3/clusters/<cluster_id>/topics

Request Example

$ curl -X POST -H "Content-Type: application/json" --data '{"topic_name": "new-topic","partitions_count": 4}' "http://localhost:8082/v3/clusters/682798077049224619/topics"

Request Response

{
  "kind":"KafkaTopic",
  "metadata":
    {
      "self":"http://node1.cluster.com:8082/v3/clusters/682798077049224619/topics/new-topic",
      "resource_name":"crn:///kafka=682798077049224619/topic=new-topic"
    },
  "cluster_id":"682798077049224619",
  "topic_name":"new-topic",
  "is_internal":false,
  "replication_factor":0,
  "partitions":
    {
      "related":"http://node1.cluster.com:8082/v3/clusters/682798077049224619/topics/new-topic/partitions"
    },
  "configs":
    {
      "related":"http://node1.cluster.com:8082/v3/clusters/682798077049224619/topics/new-topic/configs"
    },
  "partition_reassignments":
    {
      "related":"http://node1.cluster.com:8082/v3/clusters/682798077049224619/topics/new-topic/partitions/-/reassignment"
    }
}