Hear from Salesforce leaders on how to create and deploy Agentforce agents.
Contact Us 1-800-596-4880

Open Beta Release: The cloud IDE is in open beta. Any use of Anypoint Code Builder in its beta state is subject to the applicable beta services terms and conditions, available from the IDE.

Creating and Importing AsyncAPI Specifications

logo cloud IDE Cloud IDE

logo desktop IDE Desktop IDE

Use Anypoint Code Builder to design, import, govern, and test AsyncAPI specs before publishing to Anypoint Exchange:

  1. Create and design an AsyncAPI spec project in Anypoint Code Builder from the IDE or by importing the spec from MuleSoft VCS:

  2. Track progress in the output panel.

  3. Review your spec in the API console.

Use the asyncapi-example API spec to explore the functionality of Anypoint Code Builder.

Before You Begin

Create and Design a New AsyncAPI Specification Project

To create and design an AsyncAPI spec project in Anypoint Code Builder:

  1. In the activity bar of the IDE, click the (Anypoint Code Builder) icon.

    Anypoint Code Builder icon highlighted in the activity bar
  2. From Quick Actions, click Design an API:

    *Design an API* link highlighted in the *Quick Actions* section
  3. Complete the API Specification form:

    Field Name Field Value

    Project Name

    Unique name for your project.

    This name is used as the AsyncAPI spec title in Exchange, the name of the spec file, and the name of the project’s root directory. For example, if the project name is AsyncAPI Example, the spec file name is asyncapi-example.

    To reuse an existing project name, you must delete the project that is already using the name first. See Deleting API Specs and Fragments.

    Project Location

    Your home directory or another directory you create.

    Don’t create the project within another project directory.

    API Type

    The type of API spec to create.

    Available options are REST API and AsyncAPI.

    Select AsyncAPI to use the example in this procedure.

    API Specification Language

    Select AsyncAPI 2.6 (YAML) to use the example in this procedure.

  4. Click Create Project.

    If prompted, trust the authors of the files in the folder.

    When the project is ready for editing, the API project opens the spec in the Editor view, for example, this AsyncAPI 2.6 (YAML) spec:

    New AsyncAPI 2.6 (YAML) API project
  5. Continue designing your API spec.

    As you enter elements, use auto-complete (Ctrl+Space) to display available options within the context.

Import an AsyncAPI Specification from MuleSoft VCS

Import an AsyncAPI spec from MuleSoft VCS and use Git or another source-control management system compatible with VS Code in the desktop or cloud IDE to keep your project in sync. For more information, see Source Control for API Design Projects.

  1. Open the Command Palette.

  2. Provide the following command:

    MuleSoft: Import API Specification from MuleSoft VCS
    command
  3. If prompted, log in to Anypoint Platform through the IDE.

  4. Complete the import process:

    1. Select your business group from the Select a Business Group popup.

    2. Search for the API spec in the APIs from MuleSoft VCS field.

    3. Navigate to or create a folder for the spec, and click Select target folder.

      If you receive an error that the import failed (Importing project a_project_name has failed), check your target folder for a project with the same name. To address a duplicate naming issue before importing, you can import the design project to a different target folder or delete the project from your IDE (see Deleting API Specs and Fragments).

  5. Edit or continue designing your spec, as needed.

    As you enter elements, use auto-complete (Ctrl+Space) to display available options within the context.

  6. Optionally, sync your changes by using MuleSoft VCS.

    This feature is available only for API projects that you import from MuleSoft VCS. You can also store your work in another SCM. For SCM options, see Controlling Source Files.

Track Progress in the Output Panel

To track the progress of internal processing as you design your API:

  1. Open the Output panel.

  2. Select Mule DX Server from the dropdown:

    Mule DX Server in the output pane

Review Your Spec in the API Console

To display your spec in the console:

  1. Click your spec file in the editor.

  2. Click the (API Console) icon.

    Alternatively, you can provide the command MuleSoft: API Console from the Command Palette.

  3. Wait for the channels to render in the API Console.

    The API Console show the channels for the spec, for example:

    AsyncAPI spec in the API Console
    1 Click a channel to view details.
    2 Display the console menu.
  4. Click channels in the console or select items from the menu to view different parts of your spec. For example, click PUBLISH:

    API Console with Publish details

Example AsyncAPI (YAML) API Specification

If you created an AsyncAPI 2.6 (YAML) project, you can replace the initial spec with this example code: