Contact Free trial Login

Import Files into an API Project

You can import API specifications and RAML fragments into a project. There are three locations that you can import from: your computer, a location at a URL, and Anypoint Exchange.

The API specifications that you import can be written in RAML 0.8, RAML 1.0, or OpenAPI Specification (OAS) 2.0.

You can include more than one API specification in an API-specification project. You might want to have more than one specification in a project if the specifications are closely related in functionality. When you publish your project to Exchange, you select one of the specifications as the main specification.

The fragments that you import can be written in RAML 0.8 or RAML 1.0. You can import annotation types, data types, examples of JSON response payloads, libraries, resource types, security schemes, and traits.

Procedure

  • In the code editor only: To import a file or the content of a .zip file that is stored on your computer:

    1. In the left pane of the editor, click the dots to the right of Files and select Import.

    2. In the Import dialog, select File or Zip.

    Result: The file or files are listed in the left pane of the editor. If you imported a .zip file that contains files that are in a folder structure, the folder structure is represented in the pane.

  • In the code editor only: To import a file that is available through a URL:

    1. In the left pane of the editor, click the dots to the right of Files and select Import.

    2. In the Import dialog, select URL.

      • If you import a file that is available online by providing its URL, be sure that the file contains no !include statements (RAML) or $ref statements (OAS). The editor imports only the file that is at the URL.

    Result: The file is listed in the left pane of the editor.

  • To import an API specification or API fragment from Exchange, together with its dependencies:

    1. Open the Import Asset from Exchange dialog by using either of these methods:

      • In the code editor only: If your project contains only the default file that API Designer created together with the project, click the linked text that appears in the Files pane.

      • In the code editor only: If your project contains at least one file that you have created, click the three-dot icon at the top of the left pane and select Import from Exchange.

      • In the visual editor only: If your project does not yet contain any resources or data types, click the linked text that appears in the New API pane.

    2. In the drop-down menu in the top-left corner of the dialog, select the business group that owns the asset.

    3. Select one of the assets, which are listed in a table that has these columns:

      Name

      The name of an API specification or RAML fragment.

      Version

      The version of a specification or fragment. Select the Include snapshots check box in the bottom-left corner of the dialog to include snapshots in this column.

      Type

      The type of asset. The value can be either API Specification or RAML Fragment.

      Language (for API specifications being imported into the code editor)

      The language is either RAML or OAS. The value displayed by default is the language in which the specification was written. The non-default value is the language in which Exchange created a copy when the specification was published.

      If you want to import the copy, you might need to correct errors in it after you import it. The process that Exchange uses to create copies, which converts RAML to OAS or vice versa, is not guaranteed to produce error-free specifications.

      Language (for API specifications being imported into the visual editor)

      The language is always RAML. API Designer imports the RAML version of a specification, displays the RAML version in the RAML pane, and displays the OAS version in the OAS pane.

      Language (for RAML fragments)

      The language is always RAML because OAS does not use fragments.

      Date modified

      The date that the currently selected version of the currently selected asset was published.

      Created by

      The user ID of the person who published the currently selected version of the currently selected asset.

    4. Click Import Asset.

    Result: The file or files are listed in the left pane of the editor.