Contact Us 1-800-596-4880

CLI for API Manager

Command Description

Creates an API instance alert

Lists alerts for an API instance

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, 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, 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 [options] <apiInstanceId> <name>

This command creates an API instance alert with the name passed in name for the API Instance Id passed in <apiInstanceId>.

Besides the default --help, -f/--fields and -o/--output options, this command also takes:

Option Description

enabled

Sets whether the alert should be enabled or not.
Possible values are true or false.

severity <val>

Alert severity.
Supported values: Info, Warning, Critical.

type <val>

Alert type/condition.
Supported values: request-count, response-code, policy-violation, response-time

operator <val>

Condition operator explaining values relation to threshold.
Supported values: gt, lt, eq

threshold <num>

Condition occurrences threshold number.

periods <num>

Number of consecutive periods condition should occur for.

duration <num>

Condition occurrence period duration.

durationUnit <val>

Condition occurrence period duration unit.
Supported values: days, hours, minutes.

recipient [username]

Username to send alert notification to.
You can pass this option multiple times to specify multiple usernames.

email [emailAddress]

Email to send alert notification to.
You can pass this option multiple times to specify multiple emails.

responseTime [num]

Response time to trigger response-time alert type.

responseCode [code]

Response codes to trigger response-code alert type.
You can pass this option multiple times to specify multiple codes.

policyId [num]

ID of a policy applied to API instance to trigger response-code alert type.

api-mgr alert list

> api-mgr alert list [options] <apiInstanceId>

Lists alerts for the API instance passed in <apiInstanceId>.

Besides the default --help, -f/--fields and -o/--output options, this command also takes:

Option Description Example

--offset

Offsets the amount of APIs passed

api-mgr alert list --offset 3

--sort

Sorts the results in the field name passed

api-mgr alert list --sort "Latest Version"

api-mgr api change-specification

> api-mgr api change-specification [options] <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 only the default options: --help, -f/--fields and -o/--output.

api-mgr api classify

> api-mgr api classify [options] <destEnvName> <apiInstanceId>

Classifies the API instance passed in <apiInstanceId> in the environment passed in <destEnvName>.

This command accepts only the default options: --help, -f/--fields and -o/--output.

api-mgr api delete

> api-mgr api delete [options] <apiInstanceId>

This command deletes the API instance passed in <apiInstanceId>.

This command accepts only the default options: --help, -f/--fields and -o/--output.

api-mgr api deploy

> api-mgr api deploy [options] <apiInstanceId>

This command deploys the API instance passed in <apiInstanceId> to the deployment target specified using the options described below.

This command is only supported for endpoints with proxy.

Besides the default --help, -f/--fields and -o/--output options, this command also takes:

Option Description Example

target <id>

Hybrid or RTF deployment target ID.

api-mgr api deploy --target 1598794 643404

applicationName <name>

Application name

api-mgr api deploy --applicationName myMuleApp 643404

environmentName <name>

Target environment name. Should only be used when deploying APIs from unclassified environments.

api-mgr api deploy --environmentName TestEnv 643404

gatewayVersion <version>

The CloudHub Gateway version

api-mgr api deploy --gatewayVersion: 9.9.9.9 643404

overwrite

Update application if it exists.
It takes true or false values.

api-mgr api deploy --overwrite: true 643404

api-mgr api deprecate

> api-mgr api deprecate [options] <apiInstanceId>

Deprecates the API instance passed in <apiInstanceId>.

This command accepts only the default options: --help, -f/--fields and -o/--output.

api-mgr api describe

> api-mgr api describe [options] <apiInstanceId>

Shows details of the API Instance passed in <apiInstanceId>.

This command accepts only the default options: --help, -f/--fields and -o/--output.

api-mgr api download-proxy

> api-mgr api download-proxy [options] <apiInstanceId> <targetPath>

This command downloads the API proxy ZIP file of the API Instance passed in <apiInstanceId> to a local directory specified in <targetPath>.

Besides the default --help, -f/--fields and -o/--output options, this command also takes a gatewayVersion option to specify the gateway version you want to download. For example: api-mgr api download-proxy --gatewayVersion: 4.0.1 643404 /tmp/

api-mgr api edit

> api-mgr api edit [options] <apiInstanceId>

Edits the API instance passed in <apiInstanceId>.
Besides the default --help, -f/--fields and -o/--output options, this command also takes:

Option Description

-p, --withProxy

Indicates whether the endpoint should use a proxy.
This option takes true or false values.

-r, --referencesUserDomain

Indicates whether a proxy should reference a user domain.
This option takes true or false values.

-m, --muleVersion4OrAbove

Indicates whether you are managing this API in Mule 4 or above.
This option takes true or false values.

--deploymentType <value>

Deployment type.
Supported values are cloudhub, hybrid, or rtf.

--endpointUri <value>

Consumer endpoint URI.

--uri <value>

Implementation URI.

--scheme <value>

Proxy scheme.
Supported values are http, or https.

--port <value>

Proxy port.

--path <value>

Proxy path.

--responseTimeout <value>

Your maximum response timeout.

--apiInstanceLabel <value>

(Optional) API instance label.

--serviceName <value>

WSDL service name.

--serviceNamespace <value>

WSDL service namespace.

--servicePort <value>

WSDL service port.

api-mgr api list

> api-mgr api list [options]

Lists all APIs in API Manager 2.x.

Besides the default --help, -f/--fields and -o/--output options, this command also takes:

Option Description

--assetId <value>

Asset ID by which filter results.

--apiVersion <value>

API version by which filter results.

--instanceLabel <value>

API instance label by which filter results.

--limit <num>

Number of results to retrieve.

--offset

Offsets the amount of APIs passed

--sort

Sorts the results in the field name passed

api-mgr api manage

> api-mgr api manage [options] <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>.

Besides the default --help, -f/--fields and -o/--output options, this command also takes:

Option Description

--type <value>

Endpoint type.
Accepted values are http, raml, or wsdl.

-p, --withProxy

Indicates whether the endpoint should use a proxy.
This option takes true or false values.

-r, --referencesUserDomain

Indicates whether a proxy should reference a user domain.
This option takes true or false values.

-m, --muleVersion4OrAbove

Indicates whether you are managing this API in Mule 4 or above.
This option takes true or false values.

--deploymentType <value>

Deployment type.
Supported values are cloudhub, hybrid, or rtf.

--endpointUri <value>

Consumer endpoint URI.

--uri <value>

Implementation URI.

--scheme <value>

Proxy scheme.
Supported values are http, or https.

--port <value>

Proxy port.

--path <value>

Proxy path.

--responseTimeout <value>

Response timeout.

--apiInstanceLabel <value>

(Optional) API instance label.

--serviceName <value>

WSDL service name.

--serviceNamespace <value>

WSDL service namespace.

--servicePort <value>

WSDL service port.

api-mgr api promote

> api-mgr api promote [options] <apiInstanceId> <sourceEnvId>

Promotes the API instance passed in <apiInstanceId> from the source environment in <sourceEnvId>.

Besides the default --help, -f/--fields and -o/--output options, this command also takes:

Option Description

-a, --copyAlerts

Indicates whether to copy alerts.
This option takes true or false values. Default Value is true

-p, --copyPolicies

Indicates whether to copy policies.
This option takes true or false values. Default Value is true

-t, --copyTiers

Indicates whether to copy tiers.
This option takes true or false values. Default Value is true

api-mgr api redeploy

> api-mgr api redeploy [options] <apiInstanceId>

Redeploys the API Instance passed in <apiInstanceId> to the deployment target set up in the options described below.

Besides the default --help, -f/--fields and -o/--output options, this command also takes:

Option Description

--target <id>

Hybrid or RTF deployment target ID.

--applicationName <name>

Application name.

--environmentName <name>

Target environment name.
Must be provided to redeploy APIs from unclassified environments.

--gatewayVersion <version>

CloudHub Gateway version.

--overwrite

Update application if exists.
This option takes true or false values. Default Value is true

api-mgr api undeprecate

> api-mgr api undeprecate [options] <apiInstanceId>

Undeprecates the API instance passed in <apiInstanceId>.

This command accepts only the default options: --help, -f/--fields and -o/--output.

api-mgr contract delete

> api-mgr contract delete [options] <apiInstanceId> <clientId>

This command deletes the contract between the API Instance passed in <apiInstanceId>, and the client passed in <clientId>.

This command accepts only the default options: --help, -f/--fields and -o/--output.

api-mgr contract list

> api-mgr contract list [options] <apiInstanceId> [searchText]

Lists all contracts of the API passed in <apiInstanceId>.

You can specify keywords in searchText to limit results to APIs containing those specific keywords.

Besides the default --help, -f/--fields and -o/--output options, this command also takes:

Option Description Example

--limit

Number of results to retrieve

exchange asset list --limit 2

--offset

Offsets the amount of APIs passed

api-mgr contract list --offset 3 643404

--sort

Sorts the results in the field name passed

api-mgr contract list --sort "Latest Version" 643404

api-mgr policy apply

> api-mgr policy apply [options] <apiInstanceId> <policyId>

Applies the policy passed in <policyId> to the API instance passed in <apiInstanceId>.

Option Description

--policyVersion <value>

Mule 4 policy version.

--groupId <value>

Mule 4 policy group ID.
If no value is provided, this value defaults to MuleSoft group ID.

-c, --config [configJSON]

Pass the configuration data as a JSON string.
For example, api-mgr policy apply -c '{"property": "value"}'

--configFile [file]

Pass the configuration data as a file.
For example, api-mgr policy apply --configFile ./config.json

-p, --pointcut [dataJSON]

Pass pointcut data as JSON strings.
For example `api-mgr policy apply (…​) -p '[{"methodRegex":"GET

The following example defines a rate limit of one request every ten seconds:

{
        "rateLimits": [{
            "maximumRequests": 1,
            "timePeriodInMilliseconds": 10000
        }],
        "clusterizable": true,
        "exposeHeaders": false
    }

api-mgr policy describe

> api-mgr policy describe [options] <policyId>

This command shows the description and available configuration properties of the policy passed in <policyId>.

Besides the default --help, -f/--fields and -o/--output options, this command also takes:

Option Description

--policyVersion <value>

Mule4 policy version.

--groupId <value>

Mule4 policy group ID.
Defaults to MuleSoft group ID when not provided.

api-mgr policy disable

> api-mgr policy disable [options] <apiInstanceId> <policyId>

This command disables the policy passed in <policyId> from the API instance passed in <apiInstanceId>.

This command accepts only the default options: --help, -f/--fields and -o/--output.

api-mgr policy edit

> api-mgr policy edit [options] <apiInstanceId> <policyId>

This command edits the policy configuration passed in <policyId> of the API Instance passed in <apiInstanceId>.

Besides the default --help, -f/--fields and -o/--output options, this command also takes:

Option Description

-c, --config [configJSON]

Pass the configuration data as a JSON string.
For example, api-mgr policy apply -c '{"property": "value"}'

-p, --pointcut [dataJSON]

Pass pointcut data as JSON strings.
For example `api-mgr policy apply (…​) -p '[{"methodRegex":"GET

api-mgr policy enable

> api-mgr policy enable [options] <apiInstanceId> <policyId>

This command enables the policy passed in <policyId> for the API Instance passed in <apiInstanceId>.

This command accepts only the default options: --help, -f/--fields and -o/--output.

api-mgr policy list

> api-mgr policy list [options] [apiInstanceId]

This command lists all policies for all APIs in API Manager 2.x.
When the [apiInstanceId] parameter is specified, this command lists the policies applied to that API instance.

Besides the default --help, -f/--fields and -o/--output options, this command also takes the -m, --muleVersion4OrAbove option which takes true or false values.

api-mgr policy remove

> api-mgr policy remove [options] <apiInstanceId> <policyId>

This command removes the policy specified in <policyId> from the API instance passed in <apiInstanceId>.

This command accepts only the default options: --help, -f/--fields and -o/--output.

api-mgr tier add

> api-mgr tier add [options] <apiInstanceId>

This command creates an SLA tier for the API instance passed in <apiInstanceId>.

Besides the default --help, -f/--fields and -o/--output options, this command also takes:

Option Description

-a, --autoApprove

Indicates whether the SAL tier should be auto-approved.
This command only takes true or false values.

--name <value>

Tier name

--description <value>

Tier description

-l, --limit <value>

Single instance of an SLA tier limit in the form --limit A,B,C where:

  • A is a boolean indicating whether or not this limit should be visible.

  • B is a number of requests per "C" time period.

  • C is the time period unit. Time period options are:

    • ms(millisecond)

    • sec(second)

    • min(minute)

    • hr(hour)

    • d(day)

    • wk(week)

    • mo(month)

    • yr(year)

For example: --limit true,100,min is a visible limit of 100 requests per minute.

To create multiple limits, you can provide multiple --limit options.
For example: -l true,100,sec -l false,20,min

api-mgr tier copy

> api-mgr tier copy [options] <sourceAPIInstanceId> <targetAPIInstanceId>

This command copies the SLA tier from the API instance passed in <sourceAPIInstanceId> to the API instance Id passed in <targetAPIInstanceId>.

This command accepts only the default options: --help, -f/--fields and -o/--output.

api-mgr tier delete

> api-mgr tier delete [options] <apiInstanceId> <tierId>

This command deletes the SLA tier passed in <tierId> from API instance passed in <apiInstanceId>.

This command accepts only the default options: --help, -f/--fields and -o/--output.

api-mgr tier list

> api-mgr tier list [options] <apiInstanceId> [searchText]

This command lists the SLA tiers of the API instance passed in <apiInstanceId>.

Besides the default --help, -f/--fields and -o/--output options, this command also takes:

Option Description

Example

--limit

Number of results to retrieve

api-mgr tier list --limit 2

--offset

Offsets the amount of APIs passed

api-mgr tier list --offset 3

--sort

Sorts the results in the field name passed

api-mgr tier list --sort "Latest Version"