Producing Messages to Kafka
Function
This API is used to send specific messages to a Kafka instance on the console.
URI
POST /v2/{project_id}/instances/{instance_id}/messages/action
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID. For details about how to obtain it, see Obtaining a Project ID. |
instance_id |
Yes |
String |
Instance ID. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
action_id |
Yes |
String |
Action ID, which is send for production. |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
topic |
Yes |
String |
Kafka topic. |
body |
Yes |
String |
Message content. |
property_list |
Yes |
Array of property_list objects |
Topic partition information |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
topic |
String |
Kafka topic |
body |
String |
Message content. |
property_list |
Array of objects |
Topic partition information |
Example Requests
Sending messages on the Kafka console
POST https://{endpoint}/v2/{project_id}/instances/{instance_id}/messages/action?action_id={action_id} { "topic" : "XXXX", "body" : "hello world", "property_list" : [ { "name" : "KEY", "value" : "testKey" }, { "name" : "PARTITION", "value" : "0" } ] }
Example Responses
Status code: 200
Message produced.
{ "topic" : "XXXX", "body" : "XXXX", "property_list" : [ ] }
Status Codes
Status Code |
Description |
---|---|
200 |
Message produced. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot