ap is a command-line tool for managing and interacting with the WSO2 API Platform.
| Flag | Short Flag |
|---|---|
--display-name |
-n |
--server |
-s |
--output |
-o |
--file |
-f |
--version |
-v |
Note: Each command supports the
--helpflag for detailed usage information.
- You must first add and/or select a gateway in the CLI using the appropriate gateway-related commands.
- Credentials for a gateway can come from either the gateway configuration (when you add the gateway) or from environment variables. Environment variables take precedence over configuration and will override credentials stored in the config when present.
- Depending on the gateway's authentication type:
- none: No authentication required
- basic: Provide credentials via config or export
WSO2AP_GW_USERNAME=<username>andWSO2AP_GW_PASSWORD=<password>(env vars override config) - bearer: Provide a token via config or export
WSO2AP_GW_TOKEN=<token>(env var overrides config)
ap gateway add --display-name <name> --server <server> [--auth <none|basic|bearer>]# Add a gateway with no authentication (default)
ap gateway add --display-name dev --server http://localhost:9090
# Add a gateway with basic authentication
ap gateway add --display-name dev --server http://localhost:9090 --auth basic
# Add a gateway with bearer token authentication
ap gateway add --display-name prod --server https://api.example.com --auth bearerFor basic authentication, export these environment variables (replace the placeholders with your values):
export WSO2AP_GW_USERNAME=<username>
export WSO2AP_GW_PASSWORD=<password>For bearer authentication, export this environment variable (replace <token> with your token):
export WSO2AP_GW_TOKEN=<token>Note: Environment variables override credentials stored in the gateway configuration.
ap gateway listap gateway listap gateway remove --display-name <name>ap gateway remove --display-name devap gateway use --display-name <name>ap gateway use --display-name devap gateway currentap gateway currentap gateway healthap gateway healthap gateway apply --file <path>ap gateway apply --file petstore-api.yamlap gateway api listap gateway api listap gateway api get --display-name <name> --version <version> --format <json|yaml>
ap gateway api get --id <id> --format <json|yaml>ap gateway api get --display-name "PetStore API" --version v1.0 --format yaml
ap gateway api get --id sample-1 --format yamlap gateway api delete --id <id> ap gateway api delete --id <id>ap gateway image build \
[--name <gateway-name>] \
[--path <gateway-project-dir>]
[--repository <image-repository>] \
[--version <gateway-version>] \
[--gateway-builder <gateway-builder-image>] \
[--gateway-controller-base-image <gateway-controller-base-image>] \
[--router-base-image <router-base-image>] \
[--push] \
[--no-cache] \
[--platform <platform>] \
[--offline] \
[--output-dir <output_dir>]ap gateway image buildRefer to this document for more information.
ap gateway mcp listap gateway mcp listap gateway mcp get --display-name <name> --version <version> --format <json|yaml>
ap gateway mcp get --id <id> --format <json|yaml>ap gateway mcp get --display-name my-mcp --version 1.0.0 --format json
ap gateway mcp get --id sample-id --format jsonap gateway mcp delete --id <id> ap gateway mcp delete --id sample-idap gateway mcp generate --server <server> --output <path>ap gateway mcp generate --server http://localhost:3001/mcp --output target