FreeKB - delete a Route using curl
Kong - delete a Route using curl

The curl DELETE command can be used to delete a route. This assumes you have already created a route. If not, refer to Kong - create Route using curl. Let's say you've created a route with the following ID. If you do not know the ID, refer to Kong - get Route using curl.

a714d55e-a168-4efc-ae1a-6c380b0d5c84

 


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 route that has ID a714d55e-a168-4efc-ae1a-6c380b0d5c84.

curl -X DELETE "http://localhost:8001/services/foo-service/routes/a714d55e-a168-4efc-ae1a-6c380b0d5c84"

 


From a remote server

If issuing this command from a remote server, this command will delete the route that has ID a714d55e-a168-4efc-ae1a-6c380b0d5c84.

curl -X DELETE "http://hostname:8000/admin-api/services/foo-service/routes/a714d55e-a168-4efc-ae1a-6c380b0d5c84"

 


Validation

If the route was successfully deleted, something like this should be displayed. 204 No Content means the server has successfully fulfilled the request to delete the route. Additionally, the cURL command can be used to ensure the route no longer exists.

HTTP/1.1 204 No Content

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter 657aa in the box below so that we can be sure you are a human.




Comments