wso2 / wso2/api-platform

Add API undeployment through Gateway Controller REST API

Open
#1,006 0 comments 0 reactions 1 assignee View on GitHub

@dushaniw is already working on this.

Since Feb 10, 2026.

Area/Gateway Type/Improvement
Dominant language
Go
Stars
71
Forks
111
Avg merge
1d 14h
Merged PRs (30d)
110

Description

Current Limitation

The gateway-controller currently only supports permanent deletion of APIs via the DELETE /apis/{id} endpoint, which has the following behavior:

What DELETE does:

  • Removes API configuration from database
  • Deletes all API keys
  • Removes all policies
  • Stops router traffic
  • Cannot be reversed - all data is permanently lost

WebSocket vs REST API Gap:

  • ✅ Platform-API → APIUndeployedEvent (WebSocket) → Gateway sets status="undeployed" (preserves data)
  • ❌ Gateway REST API → Only DELETE available → Permanent removal

Missing Use Cases:

  • Temporary maintenance windows without losing credentials
  • Staged rollouts (undeploy v1, deploy v2, rollback if v2 fails)
  • Testing deployment workflows locally
  • Debugging production issues while preserving configuration
  • Manual intervention matching platform-triggered undeployment
Suggested Improvement

This is being discussed in https://github.com/wso2/api-platform/discussions/714#discussioncomment-15555381

Option 1: Separate REST Endpoint

Add dedicated POST /apis/{id}/undeploy endpoint.

Usage:

# Undeploy
POST /apis/{id}/undeploy

# Redeploy (use existing PUT)
PUT /apis/{id} with API YAML

Pros:

  • Clear, explicit intent
  • Simple single command to suspend
  • No YAML file needed for undeploy

Cons:

  • Asymmetry: POST to undeploy, PUT to redeploy
  • Duplicates functionality (PUT already redeploys)
  • Not declarative (conflicts with GitOps/K8s patterns)
  • Additional endpoint to maintain
Option 2: Declarative State in YAML (Recommended)

Add deploymentState field to API YAML spec, handle via existing [PUT /apis/{id}].

Enhanced YAML:

spec:
  deploymentState: undeployed  # or: deployed (default)
  displayName: Weather-API
  version: v1.0
  # ... rest of config

Usage:

# Both undeploy and redeploy use same endpoint
PUT /apis/{id} with YAML (deploymentState: undeployed)
PUT /apis/{id} with YAML (deploymentState: deployed)

Pros:

  • Declarative state matches GitOps/K8s patterns
  • Single endpoint for all changes
  • Idempotent operations
  • K8s Operator ready (CRD maps directly to spec)

Cons:

  • Requires YAML file (can't undeploy with single command)
  • More verbose for simple state changes

Note: Can add CLI helper ([ap gateway api set-state] for convenience while keeping REST API clean.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.