Delete records or empty a topic
const url = 'http://localhost:8080/api/v1/clusters/example/topics/example/delete-records';const options = { method: 'POST', headers: { cookie: 'brokerium_session=<brokerium_session>', 'X-Brokerium-Request': '1', 'Content-Type': 'application/json' }, body: '{"partitions":[{"partition":1,"offset":1}],"beforeTimestamp":1,"all":true,"dryRun":true,"confirm":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url http://localhost:8080/api/v1/clusters/example/topics/example/delete-records \ --header 'Content-Type: application/json' \ --header 'X-Brokerium-Request: 1' \ --cookie brokerium_session=<brokerium_session> \ --data '{ "partitions": [ { "partition": 1, "offset": 1 } ], "beforeTimestamp": 1, "all": true, "dryRun": true, "confirm": "example" }'Brokerium Enterprise, feature message-tools. Role: operator. Deletes the records before an offset in each listed partition, the records older than a time, or all records (Kafka DeleteRecords). Offsets past the end are clamped to the end. A dry run shows what would be deleted; otherwise confirm must repeat the topic name. Topics whose cleanup.policy does not include delete answer 409 compacted_topic.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Header Parameters
Section titled “Header Parameters”Required on every non-GET request.
Request Bodyrequired
Section titled “Request Bodyrequired”Exactly one of partitions, beforeTimestamp and all.
object
object
The records before this offset are deleted.
Unix milliseconds.
The topic name; required unless dryRun is set.
Example generated
{ "partitions": [ { "partition": 1, "offset": 1 } ], "beforeTimestamp": 1, "all": true, "dryRun": true, "confirm": "example"}Responses
Section titled “Responses”Planned or performed deletion.
object
Partitions with records to delete.
object
The new start offset.
Why the deletion failed in this partition.
Partitions where the deletion failed.
Example generated
{ "partitions": [ { "partition": 1, "startOffset": 1, "endOffset": 1, "deleteBefore": 1, "records": 1, "error": "example" } ], "records": 1, "failed": 1, "dryRun": true}Error.
object
object
Example generated
{ "error": { "code": "example", "message": "example" }}Error.
object
object
Example generated
{ "error": { "code": "example", "message": "example" }}Error.
object
object
Example generated
{ "error": { "code": "example", "message": "example" }}Error.
object
object
Example generated
{ "error": { "code": "example", "message": "example" }}Apache®, Apache Kafka® and Kafka® are either registered trademarks or trademarks of the Apache Software Foundation in the United States and/or other countries. Brokerium is not affiliated with, endorsed by, or sponsored by the Apache Software Foundation.