
The curl DELETE command can be used to delete a Consumer.
On the Kong server
If Kong is running on docker, refer to Kong - Docker container command line for the steps on how to issue commands in the Kong Docker container. Assuming you are using the default kong.conf file, the Kong Admin API will listen on port 8001.
admin_listen = 127.0.0.1:8001
If issuing this command on the Kong server, this command will delete the Consumer named "john.doe".
curl -X DELETE "http://localhost:8001/consumers/john.doe"
Or, you can do the same using the Consumer id.
curl -X DELETE "http://localhost:8001/consumers/52508431-a759-4eca-8f21-a327f6ef570c"
From a remote server
If issuing this command from a remote server, this command will delete the Consumer named "john.doe".
curl -X DELETE "http://hostname:8000/admin-api/consumers"
Or, you can do the same using the Consumer id.
curl -X DELETE "http://hostname:8000/admin-api/consumers/consumer_name_or_id"
Validation
If there are no Consumers, something like this will be displayed.
{
"message":"Not Found"
}
If there are Consumers, something like this will be displayed.
{
"custom_id":null
"created_at":1583244607
"id":"a51b05c4-fc81-4552-88a0-17842065e8b2"
"tags":null
"username":"john.doe"
}
Did you find this article helpful?
If so, consider buying me a coffee over at