Contact Us 1-800-596-4880

CLI for Exchange Assets

Use the exchange commands to automate your Exchange processes. For more information about how to use these commands, refer to the Exchange documentation.

Command Description

Copies an Exchange asset

Deletes an asset from Exchange

Deprecates an asset

Shows a given asset’s information

Downloads an Exchange asset

Lists all assets

Modifies an Exchange asset

Modifies mutable data of an existing Exchange asset

Deletes an asset’s description page from Exchange

Downloads an asset’s description page from Exchange

List all pages for a given asset

Changes an asset’s description page from Exchange

Updates an asset’s description page from Exchange

Uploads an asset’s description page from Exchange

Deletes resource from the asset portal

Downloads resource from the asset portal

Lists published resources in the asset portal

Uploads a resource to an asset portal

Undeprecates an asset

Modifies the status of an existing asset

Uploads an Exchange asset using Exchange Experience API

Exchange commands are currently not available for GovCloud.

exchange:asset:copy

> exchange:asset:copy [flags] <source> <target>

Copies the Exchange asset from <source> to <target>
Arguments <source> and <target> should be formatted as follows: ([group_id]/)<asset_id>/<version>
If group_id is not specified, it defaults to the currently selected Organization ID

In addition to the default flags, this command accepts the following flags:

Flag Description Example

--targetOrganizationId

Organization ID to copy asset into

--targetOrganizationId organization_id source_group_id/source_asset_id/source_version target_group_id/target_asset_id/target_version

exchange:asset:delete

> exchange:asset:delete [flags] <assetIdentifier>

Deletes the Exchange asset passed in <assetIdentifier>

This command does not prompt twice before deleting. If you send a delete instruction, it does not ask for confirmation.

Argument assetIdentifier should be formatted as follows: ([group_id]/)<asset_id>/<version>
If group_id is not specified, it defaults to the currently selected Organization ID

This command accepts the default flag --help.

exchange:asset:deprecate

> exchange:asset:deprecate <assetIdentifier>

Deprecates the asset passed in <assetIdentifier>

Argument assetIdentifier should be formatted as follows: ([group_id]/)<asset_id>/<version>
If group_id is not specified, it defaults to the currently selected Organization ID

This command accepts the default flags.

exchange:asset:describe

> exchange:asset:describe <assetIdentifier>

Describes the asset passed in <assetIdentifier>

Argument assetIdentifier should be formatted as follows: ([group_id]/)<asset_id>/<version>
If group_id is not specified, it defaults to the currently selected Organization ID

This command accepts the --output flag to specify the response format. Supported values are table (default) and json.

This command accepts the default flags.

exchange:asset:download

> exchange:asset:download [flags] <assetIdentifier> <directory>

Downloads the Exchange asset identified with <assetIdentifier> to the directory passed in <directory>
Argument assetIdentifier should be formatted as follows: ([group_id]/)<asset_id>/<version>
If group_id is not specified, it defaults to the currently selected Organization ID

This command accepts the default flags.

exchange:asset:list

> exchange:asset:list [flags] [searchText]

Lists all assets in Exchange

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

In addition to the default flags, this command accepts the following flags:

Flag Description Example

--limit

Number of results to retrieve

--limit 2

--offset

Offsets the number of APIs passed

--offset 3

--organizationId

Filters by organization id

--organizationId a12b3c45-de6f-789g-hi01-j2klm3nop4q5

--output

Specifies the response format.

--output json

exchange:asset:modify

> exchange:asset:modify [flags] <assetIdentifier>

Modifies the Exchange asset identified with <assetIdentifier>
Argument assetIdentifier should be formatted as follows: ([group_id]/)<asset_id>/<version>
If group_id is not specified, it defaults to the currently selected Organization ID

In addition to the default flags, this command accepts the following flags:

Flag Description Example

--name

New asset name

--name newName

--tags

Comma-separated tags for the asset

--tags tag1,tag2

exchange:asset:mutableDataUpload

> exchange:asset:mutableDataUpload [flags] <assetIdentifier>

Modifies the mutable data of an already created asset, including tags, categories, fields, and documentation

Argument assetIdentifier should be formatted as follows: [<groupID>]/<assetID>/<version>
If group_id is not specified, it defaults to the currently selected Organization ID

In addition to the default flags, this command accepts the following flags:

Flag Description Example

--docs

Documentation file (Should specify the "zip" file path)

--docs /Users/llucas/Desktop/examples/docs.zip

--categories

Categories

--categories='{"someKey":"value", "anotherKey":"anotherValue"}'

--fields

Fields

--fields='{"someKey":"value", "anotherKey":"anotherValue"}'

--tags

Tags (comma-separated)

--tags api,tag1,tag2

exchange:asset:page:delete

> exchange:asset:page:delete [flags] <assetIdentifier> <pageName>

Deletes the description page specified in <pageName>, for the asset identified with <assetIdentifier>

This command does not prompt twice before deleting. If you send a delete instruction, it does not ask for confirmation.
This command only supports published pages.

Argument assetIdentifier should be formatted as follows: ([group_id]/)<asset_id>/<version>
If group_id is not specified, it defaults to the currently selected Organization ID

This command accepts the default flags.

exchange:asset:page:download

> exchange:asset:page:download [flags] <assetIdentifier> <directory> [pageName]

Downloads the description page specified in <pageName> for the Exchange asset identified with <assetIdentifier> to the directory passed in <directory>
If [pageName] is not specified, this command downloads all pages.

This command only supports published pages.

Argument assetIdentifier should be formatted as follows: ([group_id]/)<asset_id>/<version>
If group_id is not specified, it defaults to the currently selected Organization ID
The description page is downloaded in Markdown format.

This command accepts the default flags.

exchange:asset:page:list

> exchange:asset:page:list <assetIdentifier>

Lists all pages for the asset passed in <assetIdentifier>
Argument assetIdentifier should be formatted as follows: ([group_id]/)<asset_id>/<version>
If group_id is not specified, it defaults to the currently selected Organization ID

This command only supports published pages.

This command accepts the --output flag to specify the response format. Supported values are table (default) and json.

This command accepts the default flags.

exchange:asset:page:modify

> exchange:asset:page:modify [flags] <assetIdentifier> <pageName>

Modifies the description page specified in <pageName>, for the Exchange asset identified with <assetIdentifier>

This command only supports published pages.

Argument assetIdentifier should be formatted as follows: ([group_id]/)<asset_id>/<version>
If group_id is not specified, it defaults to the currently selected Organization ID

This command accepts the --name flag to set a new asset page name.

This command accepts the default flags.

exchange:asset:page:update

> exchange:asset:page:update [flags] <assetIdentifier> <pageName> <mdPath>

Updates the content of an asset description page from the path passed in <mdPath> using the name specified in <pageName> to the Exchange asset identified with <assetIdentifier>
Naming the page "home" makes the updated page the main description page for the Exchange asset.

This command publishes all active drafts as part of the operation.

Argument assetIdentifier should be formatted as follows: [group_id]/<asset_id>/<version>
If group_id is not specified, it defaults to the currently selected Organization ID

This command accepts the default flags.

exchange:asset:page:upload

> exchange:asset:page:upload [flags] <assetIdentifier> <pageName> <mdPath>

Uploads an asset description page from the path passed in <mdPath> using the name specified in <pageName> to the Exchange asset identified with <assetIdentifier>
Naming the page "home" makes the uploaded page the main description page for the Exchange asset.

This command publishes all active drafts as part of the operation.

Argument assetIdentifier should be formatted as follows: [group_id]/<asset_id>/<version>
If group_id is not specified, it defaults to the currently selected Organization ID

This command accepts the default flags.

exchange:asset:resource:delete

> exchange:asset:resource:delete [flags] <assetIdentifier> <resourcePath>

Deletes the resource specified in <resourcePath> from the asset portal of the asset specified in <assetIdentifier> by publishing a new portal in which resourcePath has been deleted.

Argument <assetIdentifier> should be formatted as follows: [group_id]/<asset_id>/<version>
If group_id is not specified, it defaults to the currently selected Organization ID

Argument <resourcePath> must be a published resource
You can list all published resources using the asset resource list command.

This command publishes all active drafts as part of the operation.

This command accepts the default flags.

exchange:asset:resource:download

> exchange:asset:resource:download [flags] <assetIdentifier> <resourcePath> <filePath>

Downloads the published resource specified in <resourcePath> from the asset portal of the asset specified in <assetIdentifier> to the file specified in <filePath>

Argument assetIdentifier should be formatted as follows: [group_id]/<asset_id>/<version>
If group_id is not specified, it defaults to the currently selected Organization ID

Argument <resourcePath> must be a published resource
You can list all published resources using the asset resource list command.

This command only supports published resources.

This command accepts the default flags.

exchange:asset:resource:list

> exchange:asset:resource:list [flags] <assetIdentifier>

Lists the resources in the asset portal of the asset specified in <assetIdentifier>

Argument assetIdentifier should be formatted as follows: [group_id]/<asset_id>/<version>
If group_id is not specified, it defaults to the currently selected Organization ID

This command lists published resources by default.

This command accepts the --draft flag to list non-published resources in the asset portal.

Prompt the --output flag to specify the response format. Supported values are table (default) and json.

This command accepts the default flags.

exchange:asset:resource:upload

> exchange:asset:resource:upload [flags] <assetIdentifier> <filepath>

Uploads the resource specified in <filepath> to a page in the asset portal described in <assetIdentifier>

You can use this command for any page of your <assetIdentifier> asset
Supported file extensions for <filepath> are: jpeg, jpg, jpe, gif, bmp, png, webp, ico, svg, tiff, tif

The argument assetIdentifier should be formatted as follows: [group_id]/<asset_id>/<version>
If group_id is not specified, it defaults to the currently selected Organization ID

The successful output command will be a markdown codesnippet.

This command accepts the default flags.

exchange:asset:undeprecate

> exchange:asset:undeprecate <assetIdentifier>

Undeprecates the asset passed in <assetIdentifier>

Argument assetIdentifier should be formatted as follows: ([group_id]/)<asset_id>/<version>
If group_id is not specified, it defaults to the currently selected Organization ID

This command accepts the default flags.

exchange:asset:updateStatus

> exchange:asset:updateStatus [flags] <assetIdentifier>

Modifies the status of an already created asset

Argument assetIdentifier should be formatted as follows: ([group_id]/)<asset_id>/<version>
If group_id is not specified, it defaults to the currently selected Organization ID

In addition to the default flags, this command accepts the following flags:

Flag Description Example

--status

Asset status

Supported Values:

  • published

  • deprecated

--status deprecated

Valid transitions are:

From To

development

published

published

deprecated

deprecated

published

the published state corresponds to the stable state

exchange:asset:upload

> exchange:asset:upload [flags] <assetIdentifier>

Uploads a rest-api, soap-api, http-api, raml-fragment, custom, app, template, example, policy, extension, external-library, connector asset, or ruleset using the ID passed in <assetIdentifier>

Argument assetIdentifier should be formatted as follows: ([group_id]/)<asset_id>/<version>
If group_id is not specified, it defaults to the currently selected Organization ID

In addition to the default flags, this command accepts the following flags:

Flag Description Example

--categories

Categories (value should be a string in JSON format)

--categories '{"Department": "IT"}'

--dependencies

Asset dependencies (comma-separated)

--dependencies groupID:assetID:version,groupID2:assetID:version

--description

Asset description

--description "RAML"

--files

Asset file, identified as classifier.packaging or packaging and its file path
To send multiple files, you can use the same flag multiple times.
An exception to this is when you upload ruleset documentation with a ruleset. Both sets of classifiers and packaging options must be entered in a single --files flag

To upload a POM file and a RAML specification:

--files'{"pom.xml": "directory/pom-file.xml"}' --files='{"raml.raml": "./my-api.raml"}'

To upload a ruleset and its documentation:

anypoint-cli-v4 exchange asset upload my-auth-best-practices/1.0.0 --name "My Best Practices Ruleset" --description "This ruleset enforces my best practices for APIs." --files='{"ruleset.yaml":"/myRulesetFolder/mynewruleset.yaml","docs.zip":"/myRulesetFolder/ruleset.doc.zip"}'

--fields

Fields (value should be a string in JSON format)

--fields '{"releaseDate": "2020-01-01T20:00:00.000Z"}'

--keywords

Keywords (comma-separated)

--keywords raml,rest-api,someKeyword

--name

Asset name (required if no pom file is specified)

--name "Raml Asset"

--properties

Asset properties
The file of the specified "mainFile" property must be in the uploaded zip file on the root path. The file cannot be in a subfolder.

--properties='{"apiVersion":"v1", "mainFile": "api.raml"}'

--status

Asset status
Supported Values:

  • development

  • published (default)

--status development

--tags

Tags (comma-separated)

-- tags api,tag1,tag2

--type

Asset type

Required if no file is specified.

Supported Values:

  • rest-api

  • soap-api

  • http-api

  • raml-fragment

  • custom

  • connector

  • template

  • example

  • policy

  • app

  • extension

  • external-library

  • ruleset

If it is uploaded, the type is inferred from the classifier of the file

Depending on the type of asset, some possible classifier values are:

  • REST API

    • oas (with zip, yaml, or json as packaging)

    • raml (with zip or raml as packaging)

  • RAML Fragment

    • raml-fragment (with zip or raml as packaging)

  • SOAP API

    • wsdl (with zip, wsld, or xml as packaging)

  • Custom

    • custom

    • docs (with doc.zip as packaging)

  • Application

    • mule-application (with jar as packaging)

  • Policy

    • mule-policy (with jar as packaging) + policy-definition (with yaml as packaging)

  • Example

    • mule-application-example (with jar as packaging)

  • Template

    • mule-application-template (with jar as packaging)

  • Extension

    • mule-plugin (with jar as packaging)

  • Connector

    • studio-plugin (with zip as packaging) + file with no classifier and packaging jar

  • External Library

    • external-library (with jar as packaging)

  • Ruleset

    • ruleset (with zip or yaml as packaging)

--type rest-api