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_
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:
-
Go to Anypoint Platform > API Manager and select the Manage API drop-down list.
-
Select Create new API.
The Creating an asset page is displayed.
-
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.
-
In the Managing type field, select the Basic Endpoint radio button.
-
In the Application type field, select the Non-Mule application radio button.
-
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:
-
Using Anypoint Service Mesh, type the following command to create the API:
Parameter Name Description Required or Optional Default Value nameThe name of the Kubernetes API resource that you want to provision, for example,
orders-api.Required
Not applicable
namespaceThe namespace in which you want to create the adapter, for example,
mulesoft-apps.Optional
default
environmentIdThe ID of the environment where you want to create your API instance.
Required
Not applicable
groupIdThe 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.
assetIdThe ID of the assets that are a part of an organization. Supports alphanumeric characters without spaces.
Required
Not applicable
versionThe version of the asset on Exchange. The version number must follow the semantic versioning format for major, minor, and patch releases.
Required
Not applicable
instanceLabelThe ID of the API instances of an Asset within a given environment. Supports alphanumeric characters without spaces.
Required
Not applicable
specTagsTags to add to the asset on Exchange.
Optional
Not applicable
instanceTagsTags to add to the API instance on API Manager.
Optional
Not applicable
userThe username credential of the Anypoint Platform user who is creating the API.
Required
Not applicable
passwordThe password of the Anypoint Platform user who is creating the API.
Required
Not applicable
-
Verify the API status using the following command:
asmctl api listThe API that was created is displayed.
-
Optionally, you can verify that an asset is created on Exchange and an API is created on API Manager.



