Contact Us 1-800-596-4880

Import an API Specification from Exchange

Open Beta Release: AsyncAPI implementation support in Anypoint Studio is in open beta. Any use of AsyncAPI with Studio in its beta state is subject to the applicable beta services terms and conditions.

Import an AsyncAPI, OAS, or RAML API spec into a new or existing Mule project.

If you’re using Mule runtime engine (Mule) 4.1.3 and earlier, or if you prefer to import an API specification that isn’t available in Exchange, you can import an API spec from a local file or from Design Center.

If you can’t access Exchange from your work environment, you can import an API specification from your local Maven installation.

Import an API Specification from Exchange Into a New Project

  1. In the taskbar, select File > New > Mule Project.

  2. Type a name for your project.

  3. Select a Mule runtime engine version 4.1.4 or later.

  4. In the API Specification section, select the From Exchange or Maven tab.

  5. Click the Add icon (2%), and select From Exchange.

  6. Select your Anypoint Platform username.

    If you’re not logged in, click Add Account to add your Anypoint Platform account.

  7. From the list of available APIs, select one or more and click Add.

    To list all available APIs, type a * character in the search bar and press Enter.

  8. To select the version of the API to import, use the Selected Modules table.

  9. Click Finish.

Studio scaffolds your API specification. If you choose not to create flows out of your API specification, unselect Scaffold Flows From These API Specifications.

Manage the API specifications linked to Exchange in your project from the API specification project management view by clicking the Manage Mule Project APIs icon (2%) in the task bar.

Import an API Specification from Exchange Into an Existing Project

  1. Right-click on your project in the Package Explorer, select Mule, and then select Manage APIs.

  2. Click the Add icon (2%), and select From Exchange.

  3. Select your Anypoint Platform username.

    If you’re not logged in, click Add Account to add your Anypoint Platform account.

  4. Select the API from the list of available APIs and click Add.

    You can choose more than one API to import.

    To list all available APIs, type a * character in the search bar and press Enter.

    You can select the version of the API to import in the Selected Modules table.

  5. Click Finish.

Studio scaffolds your API specification. If you choose not to create flows out of your API specification, unselect Scaffold Flows From These API Specifications.

Manage the API specifications linked to Exchange in your project from the API specification project management view by clicking the Manage Mule Project APIs icon (2%) in the task bar.

If you want Studio to list your API when searching in Exchange, you must mark your API specification published as an asset as stable.

Implement AsyncAPI Specifications

Studio supports the implementation of AsyncAPI 2.6 specs. When creating an implementation project, Studio imports and scaffolds an AsyncAPI spec hosted on Exchange into an API interface that you can implement.

For supported protocols, see Supported Message Brokers in APIkit for AsyncAPI Module Reference.

Access AsyncAPI Implementation Features

  1. Open Anypoint Code Builder landing page on your Anypoint Platform cloud host (US or EU).

    Sign-in is required. The Terms & Conditions button is available to the organization administrator only.

  2. If the message AsyncAPI Beta is now available in Anypoint Code Builder and Anypoint Studio appears on the page, ask your organization administrator to join the Beta program by:

    1. Clicking Join Beta from the Anypoint Code Builder landing page

      The Join Beta button is available only to your organization administrator.

    2. Reviewing the terms and conditions of the beta program

    3. Clicking Get Access

      When the AsyncAPI feature is available for your organization, the Anypoint Code Builder landing page provides the following notification:

      AsyncAPI Implementation Beta for Anypoint Code Builder and Studio is enabled for your organization.

You must have access to a supported AsyncAPI specification hosted on Anypoint Exchange. If your AsyncAPI specification is not published to Exchange, see Publishing API Specifications. To create an AsyncAPI specification before publishing to Exchange, see AsyncAPI Specifications in the Design Center documentation.

Scaffolding Fundamentals for AsyncAPI Implementations

When scaffolding an AsyncAPI specification into a Mule project, Studio:

  • Introspects the AsyncAPI specification

  • Creates a new Mule project with a separate flow for each publish operation in the specification

  • Produces the configuration properties file dev-properties.properties file in the src/main/resources directory of your Mule project

  • Makes the APIkit for AsyncAPI module available for use in the project

    The module provides the following operations:

    • Publish (<apikit-asyncapi:publish/>): AsyncAPI subscribe operations in the specification are available for configuration as AsyncAPI Publish operations.

    • Message Listener (<apikit-asyncapi:message-listener/>): AsyncAPI publish operations in the specification are configurable Message Listener (not Publish) operations.

      The scaffolder transforms each publish operation into a Message Listener operation.

  • Generates a global-configs.xml file with connection configurations for Message Listener and Publish operations in the AsyncAPI module and for any connectors that the module depends on.

Errors can occur during the scaffolding process:

  • If no channels are defined in the specification

  • If unsupported message broker protocols are used

    For supported protocols, see Supported Message Brokers in APIkit for AsyncAPI Module Reference.

Studio doesn’t support the scaffolding of AsyncAPI, OAS, or JSON schema fragment files that are referenced from API specs. The scaffolder doesn’t add these fragments as project dependencies when you import the specification from Exchange. However, you can scaffold and reference fragments that are specified inline, within the spec. RAML fragments imported from Exchange are not affected by this limitation.