APIMATIC and MuleSoft Anypoint platform Integration

This article is outdated. Please click here to see the newer version.

This article will take you through the integration process of APIMATIC and MuleSoft Anypoint plaftorm.

Anypoint portals now allow you to embed APIMATIC widgets through image links, as shown in Figure 1. 

Image not found
Figure 1: Available widgets.

Automatic Embed Script Generation

For automatic generation of Markdown embed script, you just need to input your Anypoint API Portal Url in the input field and click the "Generate Embed Script" button. Once generated, copy and paste the embed script into a Markdown text section. If done correctly, the preview mode should render icons.

Generated Markdown Embed Script

Widgets are implemented using image links using Markdown syntax, as shown below.

[![Java SDK](https://apimatic.io/anypoint/image?template={TEMPLATE})](https://apimatic.io/anypoint/sdk?template={TEMPLATE}&token={TOKEN}&url={RAML_URL})

 You image link will include the following:

  • {TEMPLATE}, which is your chosen language or platform.
    The allowed values are: java,windows,ios,android,php,ruby,python,golang,angularjs,nodejs.
  • {TOKEN}, which is your integration token value
  • {RAML_URL}, which is either RAML as YAML, or RAML as JSON. The later has advantages in terms of faster response times.

This will produce an image icon, which on click, will generate and download your SDK. 

Manual Setup

If configuring manually, follow these steps to embed your SDK widget.

Step 1 - Get your Organization ID

Initially, sign in to your Anypoint account and create an API. If you don't already have an account, you can sign up here.

You need to have an API already created in order to proceed. Open the created API portal and take a look at the URL in the address bar. As shown in Figure 2, you can identify your Organization ID, API ID and Version ID from the URL. 

Image not found
Figure 2: API portal URL.

Save these details for later use.

Step 2 - Get your Integration Token

 In order to get your integration token, sign in to your APIMATIC account. Navigate to your profile by clicking on your email on the top-right corner in the nav-bar, as shown in Figure 3. 

Image not found
Figure 3: APIMATIC profile.


Click on "Anypoint Portal" in the left-hand side menu and provide your Orgnization ID you saved earlier. Next, click "Generate Token" button.

Step 3 - Markdown Embed Script

Once you have generated your integration token, you can either manually use it to configure your SDK widgets, or you can use the auto-generated Markdown embed script.

See the Advanced Settings section for more details on how to manually write and customize the embed script.

After the integration token has been generated, a new section will appear where you can input your "API ID" and "Version ID". Next, click "Generate Embed Code" button, as shown in Figure 4.

Image not found
Figure 4: Providing API ID and Version ID.

Step 4 - Copy The Generated Script

After clicking the "Generate Embed Code", a new window will open to show you the generated "Markdown embed script".

Copy this code and paste it in a new Markdown script section in Anypoint API Portal, as shown in Figure 5.

Image not found
Figure 5: Providing API ID and Version ID.


If done correctly, the preview mode will show download icons as shown below. You can click on these icons and download SDKs for the specified API, as shown in Figure 6.

Image not found
Figure 6 Download Icons.

Advanced Settings

1. Code Generation Settings Profile

The code generated is already fully functional. However, you may customize your code even further with our CodeGen Settings. The flexibility offered helps you generate code the way you want it. From minor things such as prefixes and post-fixes, to major stuff such as dynamic parameters and asynchronous code, you have control over all aspects. In order to modify these settings you need you navigate to your "CodeGen Profile", as shown in Figure 7.

Image not found
Figure 7: Code Gen Profile.

2. Image Icon Settings

You can use your icon by replacing the image URLs with your own icon URLs. You can also change the size of your image icon by changing the size parameter in the image URL, as shown below. 


3. Caching Settings

By default, Anypoint uses smart caching to reduce code generation costs. However, if your API is in development mode, or you are facing issues with getting up-to-date SDKs, you can disable the cache temporarily. It is not advised to disable cache permanently as this could incur higher costs of code generation. Disabling cashing is done by altering the URL as shown in the example below. 

[![Java SDK](https://apimatic.io/anypoint/image?template={TEMPLATE})](https://apimatic.io/anypoint/sdk?template={TEMPLATE}&token={TOKEN}&url={RAML_URL}&cache=no)

4. Error Handling:

APIMATIC displays custom useful error messages in case of errors. Some of the most common errors are:

  • Using an invalid or a private URL for RAML description, which cannot be read by APIMATIC.

  • Using a token that is configured for another Organization ID. This may often be case if you have more than one accounts/organizations in Anypoint platform. In this case, you need to update your integration token with the new Organization ID.

  • Forgetting to specify, or specifying incorrect values of {TEMPLATE}. The allowed values are listed above

  • SDKis not up-to-date from JSONified RAML URL. This is caused by having your Mock Server turned off while making changes to your API. This makes the JSON version of your API description get out of sync.

If none of these errors apply to you, please contact our support


Go to top

Have more questions? Submit a request