CLI for API Manager
Use the api-mgr
commands to automate your API Manager Processes. For more information about how to use these commands, refer to the API Manager documentation.
Command | Description |
---|---|
Creates an API instance alert |
|
Lists alerts for an API instance |
|
Lists the autodiscovery properties |
|
Changes the asset version for an API instance by choosing a new version from Exchange |
|
Classifies an API instance in a given environment |
|
Deletes an API |
|
Deploys an API to CloudHub, CloudHub2, Hybrid Server, or Runtime Fabric |
|
Deprecates an API instance |
|
Shows details of an API |
|
Downloads the API proxy ZIP file to a local directory |
|
Edits an API instance |
|
Lists all APIs in API Manager 2.x |
|
Manages a new API, API version, or new API instance with an asset from Exchange |
|
Promotes an API instance from source environment |
|
Redeploys an API to CloudHub, CloudHub2, Hybrid Server, or Runtime Fabric |
|
Undeprecates an API instance |
|
Deletes a given API contract |
|
Lists all contracts to a given API instance |
|
Applies a policy to a given API instance |
|
Shows the description and available configuration properties of a given policy template |
|
Disables policy from a given API instance |
|
Edits the policy configuration of a given API instance |
|
Enables a policy on a given API instance |
|
Lists policies |
|
Removes a policy from a given API instance |
|
Creates an SLA tier |
|
Copies an SLA tier from source to a target API instance |
|
Deletes an SLA tier from an API instance |
|
Lists the SLA tiers of an API instance |
api-mgr:alert:add
> api-mgr:alert:add <apiInstanceId> <name> [flags]
Creates an API instance alert with the name passed in name
for the API instance ID passed in <apiInstanceId>
.
In addition to the default flags, this command accepts the following flags:
Flag | Description | Example |
---|---|---|
|
Condition occurrence period duration. |
|
|
Condition occurrence period duration unit. |
|
|
Email to send alert notification to. |
|
|
Sets whether the alert is enabled. Include the flag to enable the alert. |
|
|
Condition operator that explains values in relation to threshold. |
|
|
Specifies the response format, supported values are |
|
|
Number of consecutive periods condition should occur for. |
|
|
ID of a policy applied to the API instance that triggers a |
|
|
Username to send alert notification to. |
|
|
Response codes to trigger |
|
|
Response time to trigger |
|
|
Alert severity. |
|
|
Condition occurrences threshold number. |
|
|
Alert type/condition. |
|
This command has multi-option flags. When using multi-option flags in a command, either put the parameter before the flags or use a `-- ` (two dashes followed by a space) before the parameter. |
api-mgr:alert:list
> api-mgr:alert:list [flags] <apiInstanceId>
Lists alerts for the API instance passed in <apiInstanceId>
.
In addition to the default flags, this command accepts the following flags:
Flag | Description | Example |
---|---|---|
|
Number of results to retrieve, default is 10 results |
|
|
Offsets the amount of APIs passed |
|
|
Specifies the response format |
|
|
Sorts the results in the field name passed |
|
api-mgr:api:autodiscovery
> api-mgr:api:autodiscovery [flags] <apiInstanceId> <name>
This command lists the autodiscovery properties required for a gateway to track the API Instance Id passed in <apiInstanceId>
.
In addition to the default flags, this command accepts the following flags:
Flag | Description | Example |
---|---|---|
|
Specifies the gateway version to download |
|
|
Specifies the response format |
|
api-mgr:api:change-specification
> api-mgr:api:change-specification [flags] <apiInstanceId> <assetVersion>
Changes the asset version for the API instance passed in <apiInstanceId>
by choosing a new version from Exchange passed in <assetVersion>
.
This command accepts the --output
flag to specify the response format. Supported values are table
(default) and json
.
This command accepts the default flags.
api-mgr:api:classify
> api-mgr:api:classify [flags] <destEnvName> <apiInstanceId>
Classifies the API instance passed in <apiInstanceId>
in the environment passed in <destEnvName>
.
This command accepts the --output
flag to specify the response format. Supported values are table
(default) and json
.
This command accepts the default flags.
api-mgr:api:delete
> api-mgr:api:delete [flags] <apiInstanceId>
Deletes the API instance passed in <apiInstanceId>
. If the API instance is deployed, this command undeploys the API instance before deleting it.
This command accepts the --output
flag to specify the response format. Supported values are table
(default) and json
.
This command accepts the default flags.
api-mgr:api:deploy
> api-mgr:api:deploy [flags] <apiInstanceId>
Deploys the API instance passed in '<apiInstanceId>' to the deployment target specified using the flags described next. Deploy any undeployed API using this command regardless of whether it was created using the API Manager CLI or API Manager UI.
This command is only supported for endpoints with proxy. |
In addition to the default flags, this command accepts the following flags:
Flag | Description | Example |
---|---|---|
|
Application name |
|
|
Target environment name, only for when deploying API instances from unclassified environments |
|
|
The CloudHub Gateway version |
|
|
Gateway Java version |
|
|
Set the name of the release channel to be used for the selected Mule version. + Supported values are |
|
|
Update application if it exists |
|
|
Specifies the response format, supported values are |
|
|
Hybrid, RTF, CH, or CH2 deployment target ID |
|
api-mgr:api:deprecate
> api-mgr:api:deprecate [flags] <apiInstanceId>
Deprecates the API instance passed in <apiInstanceId>
.
This command accepts the --output
flag to specify the response format. Supported values are table
(default) and json
.
This command accepts the default flags.
api-mgr:api:describe
> api-mgr:api:describe [flags] <apiInstanceId>
Shows details of the API instance passed in <apiInstanceId>
.
This command accepts the --output
flag to specify the response format. Supported values are table
(default) and json
.
This command accepts the default flags.
api-mgr:api:download-proxy
> api-mgr:api:download-proxy [flags] <apiInstanceId> <targetPath>
This command downloads the API proxy ZIP file of the API instance passed in <apiInstanceId>
to a local directory specified in <targetPath>
. You cannot download the API proxy of a Flex Gateway API instance.
This command accepts the --gatewayVersion
flag to specify the gateway version to download.
For example: api-mgr:api:download-proxy --gatewayVersion: 4.0.1 643404 /tmp/
This command also accepts the --output
flag to specify the response format
Supported values are table
(default) and json
.
This command accepts the default flags.
api-mgr:api:edit
> api-mgr:api:edit [flag] <apiInstanceId>
Edits the API instance passed in <apiInstanceId>
. Editing a deployed Flex Gateway API instance redeploys the instance.
In addition to the default flags, this command accepts the following flags:
Flag | Description | Example |
---|---|---|
|
Indicates whether this is a Flex Gateway API instance. |
|
|
Indicates whether this is a Mule 4 API instance. |
|
|
Indicates whether the endpoint should use a proxy. |
|
|
Indicates whether a proxy should reference a user domain. |
|
`--apiInstanceLabel ` |
API instance label |
|
|
Deployment type |
|
|
Consumer endpoint URI (required) |
|
|
Inbound secret group ID |
|
|
Outbound TLS Context ID |
|
|
Outbound secret group ID. |
|
|
Outbound TLS Context ID. |
|
|
Specifies the response format, supported values are |
|
|
Proxy path (required) |
|
|
Proxy port (required) |
|
|
Client Identity Provider Id that the API is associated with |
|
|
Maximum response timeout(required) |
|
|
Proxy scheme (required) |
|
|
WSDL service name |
|
|
WSDL service namespace. Flex Gateway does not support this flag. |
|
|
WSDL service port |
|
|
Updates the TLS context of API instances sharing the port of this API. |
|
|
Implementation URI. |
|
api-mgr:api:list
> api-mgr:api:list [flags]
Lists all APIs in API Manager 2.x.
In addition to the default flags, this command accepts the following flags:
Flag | Description | Example |
---|---|---|
|
API version that filters results |
|
|
Asset ID that filters results |
|
|
API instance label that filters results |
|
|
Number of results to retrieve |
|
|
Offsets the amount of APIs passed |
|
|
Specifies the response format, supported values are |
|
|
Sorts the results in the field name passed |
|
api-mgr:api:manage
> api-mgr:api:manage [flags] <assetId> <assetVersion>
Manages a new API, API version, or new API instance with the Exchange asset passed in <assetId>
, and the version passed in <assetVersion>
.
Flex Gateway API instances created with Anypoint CLI do not support multiple upstream services. To create Flex Gateway API instances with multiple upstream services, see: |
In addition to the default flags, this command accepts the following flags:
Flag | Description | Example |
---|---|---|
|
Indicates whether this is a Flex Gateway API instance. |
|
|
Indicates whether this is a Mule 4 API instance. |
|
|
Indicates whether the endpoint should use a proxy. |
|
|
Indicates whether a proxy should reference a user domain. |
|
`--apiInstanceLabel ` |
API instance label |
|
|
Deployment type |
|
|
Consumer endpoint URI (required) |
|
|
Inbound secret group ID |
|
|
Outbound TLS Context ID |
|
|
Outbound secret group ID. |
|
|
Outbound TLS Context ID. |
|
|
Specifies the response format, supported values are |
|
|
Proxy path (required) |
|
|
Proxy port (required) |
|
|
Client Identity Provider Id that the API is associated with |
|
|
Maximum response timeout(required) |
|
|
Proxy scheme (required) |
|
|
WSDL service name |
|
|
WSDL service namespace. Flex Gateway does not support this flag. |
|
|
WSDL service port |
|
|
Endpoint type |
|
|
Implementation URI |
|
api-mgr:api:promote
> api-mgr:api:promote [flags] <apiInstanceId> <sourceEnvId>
Promotes the API instance passed in <apiInstanceId>
from the source environment in <sourceEnvId>
.
In addition to the default flags, this command accepts the following flags:
Flag | Description | Example |
---|---|---|
|
Indicates whether to copy alerts |
|
|
Indicates whether to copy policies |
|
|
Indicates whether to copy tiers |
|
|
Specifies the response format, supported values are |
|
|
Indicates the provider’s ID associated with the API. |
|
api-mgr:api:redeploy
> api-mgr:api:redeploy [flags] <apiInstanceId>
Redeploys the API instance passed in <apiInstanceId>
to the deployment target set up in the flags described below.
In addition to the default flags, this command accepts the following flags:
Flag | Description | Example |
---|---|---|
|
Application name |
|
|
Target environment name |
|
|
CloudHub Gateway version |
|
|
Gateway Java version |
|
|
Update application if it exists |
|
|
Specifies the response format, supported values are |
|
|
Set the name of the release channel to be used for the selected Mule version. + Supported values are |
|
|
Hybrid, RTF, CH, or CH2 deployment target ID |
|
api-mgr:api:undeprecate
> api-mgr:api:undeprecate [flags] <apiInstanceId>
Undeprecates the API instance passed in <apiInstanceId>
.
This commands accepts the --output
flag to specify the response format. Supported values are table
(default) and json
.
This command accepts the default flags.
api-mgr:contract:delete
> api-mgr:contract:delete [flags] <apiInstanceId> <clientId>
This command deletes the contract between the API instance passed in <apiInstanceId>
, and the client passed in <clientId>
.
This command accepts the --output
flag to specify the response format. Supported values are table
(default) and json
.
This command accepts the default flags.
api-mgr:contract:list
> api-mgr:contract:list [flags] <apiInstanceId> [searchText]
Lists all contracts of the API passed in <apiInstanceId>
.
You can specify keywords in searchText to limit results of APIs containing those specific keywords. |
In addition to the default flags, this command accepts the following flags:
Flag | Description | Example |
---|---|---|
|
Number of results to retrieve |
|
|
Offsets the amount of APIs passed |
|
|
Specifies the response format, supported values are |
|
|
Sorts the contracts by the criteria associated with their client applications |
|
api-mgr:policy:apply
> api-mgr:policy:apply [flags] <apiInstanceId> <policyId>
Applies the policy passed in <policyId>
to the API instance passed in <apiInstanceId>
.
In addition to the default flags, this command accepts the following flags:
Flag | Description | Example |
---|---|---|
|
Pass the configuration data as a JSON string |
|
|
Pass the configuration data as a file |
|
|
Mule 4 policy group ID |
|
|
Specifies the response format, supported values are |
|
|
Pass pointcut data as JSON strings |
|
|
Mule 4 policy version. |
|
The following example defines a rate limit of one request every ten seconds:
{ "rateLimits": [{ "maximumRequests": 1, "timePeriodInMilliseconds": 10000 }], "clusterizable": true, "exposeHeaders": false }
Even if you plan to use the default values, you must configure all required policy parameters when applying a policy with Anypoint CLI, |
api-mgr:policy:describe
> api-mgr:policy:describe [flags] <policyId>
Shows the description and available base configuration properties of the policy name passed in <policyId>
.
In addition to the default flags, this command accepts the following flags:
Flag | Description | Example |
---|---|---|
|
Mule 4 policy group ID + Defaults to the MuleSoft group ID. |
|
|
Mule 4 policy version |
|
|
Specifies the response format |
|
api-mgr:policy:disable
> api-mgr:policy:disable [flags] <apiInstanceId> <policyInstanceId>
Disables the policy passed in <policyInstanceId>
from the API instance passed in <apiInstanceId>
.
This command accepts the --output
flag to specify the response format. Supported values are table
(default) and json
.
This command accepts the default flags.
api-mgr:policy:edit
> api-mgr:policy:edit [flags] <apiInstanceId> <policyInstanceId>
Edits the policy configuration passed in <policyInstanceId>
for the API instance passed in <apiInstanceId>
.
If you are udpating an included Mule Gateway policy, you can include only the changed values in the configuration. However, if you are updating a custom policy, you must send the full configuration each time a custom policy is edited. |
In addition to the default flags, this command accepts the following flags:
Flag | Description | Example |
---|---|---|
|
Pass the configuration data as a JSON string |
|
|
Pass the configuration data as a file |
|
|
Specifies the response format, supported values are |
|
|
Pass pointcut data as JSON strings |
|
api-mgr:policy:enable
> api-mgr:policy:enable [flags] <apiInstanceId> <policyInstanceId>
Enables the policy passed in <policyInstanceId>
for the API instance passed in <apiInstanceId>
.
This command accepts the --output
flag to specify the response format. Supported values are table
(default) and json
.
This command accepts the default flags.
api-mgr:policy:list
> api-mgr:policy:list [flags] [apiInstanceId]
Lists all policies for all APIs in API Manager 2.x.
Specify the --apiInstanceId
flag to list the policies applied to that API instance. Without the --apiInstanceId
flag, the command lists all policies for all APIs.
This command accepts the -m, --muleVersion4OrAbove
flag.
This command accepts the default flags.
api-mgr:policy:remove
> api-mgr:policy:remove [flags] <apiInstanceId> <policyInstanceId>
This command removes the policy specified in <policyInstanceId>
from the API instance passed in <apiInstanceId>
.
This command accepts the --output
flag to specify the response format. Supported values are table
(default) and json
.
This command accepts the default flags.
api-mgr:tier:add
> api-mgr:tier:add [flags] <apiInstanceId>
This command creates an SLA tier for the API instance passed in <apiInstanceId>
.
In addition to the default flags, this command accepts the following flags:
Flag | Description | Example | ||
---|---|---|---|---|
|
Indicates whether the SAL tier should be auto-approved |
|
||
|
Tier name |
|
||
|
Tier description |
|
||
|
Single instance of an SLA tier limit in the form
|
|
||
|
Specifies the response format, supported values are |
|
api-mgr:tier:copy
> api-mgr:tier:copy [flags] <sourceAPIInstanceId> <targetAPIInstanceId>
Copies the SLA tier from the API instance passed in <sourceAPIInstanceId>
to the API instance Id passed in <targetAPIInstanceId>
.
This command accepts the --output
flag to specify the response format. Supported values are table
(default) and json
.
This command accepts the default flags.
api-mgr:tier:delete
> api-mgr:tier:delete [flags] <apiInstanceId> <tierId>
This command deletes the SLA tier passed in <tierId>
from API instance passed in <apiInstanceId>
.
This command accepts the --output
flag to specify the response format. Supported values are table
(default) and json
.
This command accepts the default flags.
api-mgr:tier:list
> api-mgr:tier:list [flags] <apiInstanceId> [searchText]
This command lists the SLA tiers of the API instance passed in <apiInstanceId>
.
In addition to the default flags, this command accepts the following flags:
Flag | Description | Example |
---|---|---|
|
Number of results to retrieve |
|
|
Offsets the amount of APIs passed |
|
|
Specifies the response format, supported values are |
|
|
Sorts the results in the field name passed |
|