
The curl DELETE command can be used to delete a service.
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 "foo-service".
curl -X DELETE "http://localhost:8001/services/foo-service"
Or, you can do the same with the service ID.
curl -X DELETE "http://localhost:8001/services/8b2be1ef-c633-426d-bfbf-7e5e000000ad"
From a remote server
If issuing this command from a remote server, this command will delete "foo-service".
curl -X DELETE "http://hostname:8000/admin-api/services/foo-service"
Or, you can do the same with the service ID.
curl -X DELETE "http://hostname:8000/admin-api/services/8b2be1ef-c633-426d-bfbf-7e5e000000ad"
Validation
Regardless if the service was or was not successfully deleted, there will be no output. The curl GET command can be used to ensure the service no longer exists.
Did you find this article helpful?
If so, consider buying me a coffee over at