Deleting an API Gateway or an API Deployment
Find out how to delete API gateways and API deployments that you previously created with the API Gateway service.
After you have created an API gateway, and deployed an API on the API gateway by creating an API deployment, you might decide that either or both are no longer required.
- You can delete an API gateway from the API Gateway service, provided there are no API deployments on it.
- You can delete individual API deployments on an API gateway, one at a time. When you delete an API deployment, its API deployment specification is permanently removed.
Deleted API gateways and API deployments continue to be shown in the Console for 90 days, with a status of Deleted. After 90 days, deleted API gateways and API deployments are no longer shown.
- Open the navigation menu and click Developer Services. Under API Management, click Gateways.
- Select the compartment that contains the API gateway that you want to delete, or that has the API deployment that you want to delete.
- Click the name of the API gateway to open its details page.
- To delete the API gateway, click Delete.
The API gateway is permanently removed. Note that you cannot delete an API gateway if it still has API deployments on it. You must delete the API deployments first.
- To delete an API deployment on the API gateway, select Deployments from the Resources list, click the
The API deployment and its API deployment specification are permanently removed.
beside the API deployment you want to delete, and select Delete.
To delete API gateways and API deployments using the CLI:
- Configure your client environment to use the CLI (Configuring Your Client Environment to use the CLI for API Gateway Development).
-
To delete an existing API gateway:
-
Open a command prompt and run
oci api-gateway gateway delete
to delete the API gateway:oci api-gateway gateway delete --gateway-id <gateway-ocid>
where:
<gateway-ocid>
is the OCID of the API gateway to delete. To find out the API gateway's OCID, see Listing API Gateways and API Deployments.
For example:
oci api-gateway gateway delete --gateway-id ocid1.apigateway.oc1..aaaaaaaab______hga
Note that you cannot delete an API gateway if it still has API deployments on it (including API deployments that are in different compartments to the API gateway itself). You must delete the API deployments first.
The response to the command includes:
- The lifecycle state (for example, DELETED, FAILED).
- The id of the work request to delete the API gateway (details of work requests are available for seven days after completion, cancellation, or failure).
If you want the command to wait to return control until the API gateway has been deleted (or the request has failed), include either or both the following parameters:
--wait-for-state DELETED
--wait-for-state FAILED
For example:
oci api-gateway gateway delete --gateway-id ocid1.apigateway.oc1..aaaaaaaab______hga --wait-for-state DELETED
-
(Optional) To see the status of the work request that is deleting the API gateway, enter:
oci api-gateway work-request get --work-request-id <work-request-ocid>
-
(Optional) To view the logs of the work request that is deleting the API gateway, enter:
oci api-gateway work-request-log list --work-request-id <work-request-ocid>
-
(Optional) If the work request that is deleting the API gateway fails and you want to review the error logs, enter:
oci api-gateway work-request-error --work-request-id <work-request-ocid>
-
(Optional) To verify that the API gateway has been deleted, enter the following command and confirm that the API gateway's lifecycle state is DELETED:
oci api-gateway gateway get --gateway-id <gateway-ocid>
-
-
To delete an existing API deployment:
-
Open a command prompt and run
oci api-gateway deployment delete
to delete the API deployment:oci api-gateway deployment delete --deployment-id <deployment-ocid>
where:
<deployment-ocid>
is the OCID of the API deployment to delete. To find out the API deployment's OCID, see Listing API Gateways and API Deployments.
For example:
oci api-gateway deployment delete --deployment-id ocid1.apideployment.oc1..aaaaaaaaab______pwa
The response to the command includes:
- The lifecycle state (for example, ACTIVE, DELETED).
- The id of the work request to delete the API deployment (details of work requests are available for seven days after completion, cancellation, or failure).
If you want the command to wait to return control until the API deployment is active (or the request has failed), include either or both the following parameters:
--wait-for-state DELETED
--wait-for-state FAILED
For example:
oci api-gateway deployment delete --deployment-id ocid1.apideployment.oc1..aaaaaaaaab______pwa --wait-for-state DELETED
-
(Optional) To see the status of the work request that is deleting the API deployment, enter:
oci api-gateway work-request get --work-request-id <work-request-ocid>
-
(Optional) To view the logs of the work request that is deleting the API deployment, enter:
oci api-gateway work-request-log list --work-request-id <work-request-ocid>
-
(Optional) If the work request that is deleting the API deployment fails and you want to review the error logs, enter:
oci api-gateway work-request-error --work-request-id <work-request-ocid>
-
(Optional) To verify that the API deployment has been deleted, enter the following command and confirm that the API deployment 's lifecycle state is DELETED:
oci api-gateway deployment get --deployment-id <deployment-ocid>
-
For more information about using the CLI, see Command Line Interface (CLI). For a complete list of flags and options available for CLI commands, see CLI Help.
Run the:
- DeleteGateway operation to delete an API gateway.
- DeleteDeployment operation to delete an API deployment.