Contact Free trial Login

Create an API Using the CLI

After you provision the adapter, you must create an API to bind to the service. You can create an API using Anypoint Platform or Anypoint Service Mesh:

  • Create an API using Anypoint Platform

    If you want to create REST or SOAP APIs with OAS or WSDL definition, use Anypoint Platform.

    Note that if you want to upload a REST API or OAS asset type, use a .json or .yaml file. Alternatively, if you want to upload a SOAP API or WSDL asset type, use a .wsdl or .xml file.

  • Create an API using Anypoint Service Mesh Autocreate

    Anypoint Service Mesh enables you to automatically create an HTTP API in Anypoint Platform, with no REST or SOAP definitions. You do not have to manually log in to Anypoint Platform.

    If you automatically create REST or SOAP APIs with Anypoint Service Mesh, the APIs are still managed internally as an HTTP asset without any definition.

Create an API Using Anypoint Platform

To create an API using Anypoint Platform, perform the following steps:

  1. Go to Anypoint Platform > API Manager and select the Manage API drop-down list.

  2. Select Create new API.

    The Creating an asset page is displayed.

  3. Specify a Name value and Asset types details for the API.

    Your asset is now created in Exchange for reuse. After you create the asset, you are ready to perform endpoint configuration.

    The Endpoint Configuration window is displayed.

  4. In the Managing type field, select the Basic Endpoint radio button.

  5. In the Application type field, select the Non-Mule application radio button.

  6. Optionally, specify the Implementation URI, and click Save.

    Your API is now created.

Create an API Using Anypoint Service Mesh

Use the procedure in this section to automatically create an API using Anypoint Service Mesh. Before you create the API, you must complete the task prerequisite.

Task Prerequisite

Before you begin, ensure that you obtain the:

  • Environment ID and organization ID.

    To obtain these details, go to API Manager > Environment Information.

  • Manage APIs Configuration permission for the environment where you are creating the API Instance.

  • Exchange Contributor permission for the business group where you are creating the asset.

To create an API using Anypoint Service Mesh, perform the following steps:

  1. Using Anypoint Service Mesh, type the following command to create the API:

    asmctl api create \
    --name=_Kubernetes API resource name_ \
    --namespace=_namespace name_ \
    --environmentId=_environment ID_ \
    --groupId=_(Optional) group ID of the asset, for example, organization ID_ \
    --assetId=_asset ID on Exchange_ \
    --version=_Asset version of the instance on exchange_ \
    --instanceLabel=_label of the instance on API Manager_ \
    --specTags=_list of comma separated tags to be added to the asset on Exchange_ \
    --instanceTags=_list of comma separated tags to be added to the instance on API Manager_ \
    --user=_username of the Anypoint Platform user, creating the API instance_ \
    --password=_password of the Anypoint Platform user, creating the API instance_
    Parameter Name Description Required or Optional Default Value

    name

    The name of the Kubernetes API resource that you want to provision, for example, orders-api.

    Required

    Not applicable

    namespace

    The namespace in which you want to create the adapter, for example, mulesoft-apps.

    Optional

    default

    environmentId

    The ID of the environment where you want to create your API instance.

    Required

    Not applicable

    groupId

    The ID of the group of assets on Exchange, for example, the organization ID. You can find the organization ID on the API Manager landing page or in Access Management.

    Optional

    Organization ID of the organization that contains the environment.

    assetId

    The ID of the assets that are a part of an organization. Supports alphanumeric characters without spaces.

    Required

    Not applicable

    version

    The version of the asset on Exchange. The version number must follow the semantic versioning format for major, minor, and patch releases.

    Required

    Not applicable

    instanceLabel

    The ID of the API instances of an Asset within a given environment. Supports alphanumeric characters without spaces.

    Required

    Not applicable

    specTags

    Tags to add to the asset on Exchange.

    Optional

    Not applicable

    instanceTags

    Tags to add to the API instance on API Manager.

    Optional

    Not applicable

    user

    The username credential of the Anypoint Platform user who is creating the API.

    Required

    Not applicable

    password

    The password of the Anypoint Platform user who is creating the API.

    Required

    Not applicable

  2. Verify the API status using the following command: asmctl api list

    The API that was created is displayed.

  3. Optionally, you can verify that an asset is created on Exchange and an API is created on API Manager.

Was this article helpful?

💙 Thanks for your feedback!

Edit on GitHub