Deleting a virtual host/environment/organization

This section shows how to remove organizations, environments, and virtual hosts. The order of API calls is very important; for example, the step to remove an organization can only be executed after you remove all associated environments in the organization.

Delete a virtual host

Before you can delete a virtual host from an environment, you must update any API proxies that reference the virtual host to remove the reference. See Virtual hosts for more.

Use the following API to delete a virtual host:

curl -u <admin user>:<admin passwd> -X DELETE \
"http://ms_IP:8080/v1/organizations/org_name/environments/env_name/virtualhosts/virtualhost_name"

Delete an environment

You can only delete an environment after you have:

  1. Deleted all virtual hosts in the environment as described above.
  2. Disassociated the environment from all Message Processors.
  3. Cleaned up analytics.

Disassociate an environment from Message Processor

Use the following API to remove an association of an environment with a Message Processor. If you want to delete the environment, you must disassociate it from all Message Processors:

curl -H "Content-Type: application/x-www-form-urlencoded" \
-u ADMIN_USERNAME:ADMIN_PASSWORD -X POST \
"http://ms_IP:8080/v1/organizations/org_name/environments/env_name/servers" \
-d "action=remove&uuid=uuid"

Where uuid is the UUID of Message Processor.

Clean up analytics

To remove analytics information about the organization:

curl -u ADMIN_EMAIL:ADMIN_PASSWORD -X DELETE \
"http://ms_IP:8080/v1/analytics/groups/ax/analytics_group/scopes?org=org_name&env=env_name"

Where analytics_group defaults to "analytics-001".

If you are unsure of the name of the analytics group, use the following command to display it:

apigee-adminapi.sh analytics groups list --admin ADMIN_EMAIL --pwd ADMIN_PASSWORD --host localhost

This command returns the analytics group name in the name field.

Delete the environment

To delete an environment:

curl -u ADMIN_EMAIL:ADMIN_PASSWORD \
"http://ms_IP:8080/v1/organizations/org_name/environments/env_name" \ -X DELETE

Delete an organization

You can only delete an organization after you have:

  1. Deleted all virtual hosts in all environments in the organization as described above.
  2. Deleted all environments in the organization as described above.
  3. Disassociated the organization from all pods.

Disassociate an organization from a pod

Use the following API to disassociate an organization from a pod:

curl -H "Content-Type: application/x-www-form-urlencoded" \
-u ADMIN_EMAIL:ADMIN_PASSWORD -X POST "http://ms_IP:8080/v1/organizations/org_name/pods" \
-d "action=remove&region=region_name&pod=pod_name"

Delete the organization

Use the following API to delete an organization:

curl -u ADMIN_EMAIL:ADMIN_PASSWORD -X DELETE "http://ms_IP:8080/v1/organizations/org_name"