RAML-Based REST API with MuleSoft API Manager

Anypoint Platform™ is one of the leading integration platforms in the world for SOA, SaaS, and APIs. This tutorial is based on Muslesoft API Manager and I will be discussing how we can create a RAML (Rest API Modeling Language) based REST API using MuleSoft API Manager. RAML is a YAML-like format, that can be used to design REST APIs. There are various features in RAML, including standardization, reusability, easy readability, and much more.

First, I assume that you have an active Anypoint Platform™ account, if not, please create a free trial account.

Now, we will walk through how to create REST APIs using API Manager. Log into your Anypoint Platform™ account. First, we are going to design an API. For that, we can use the Design Center. Click on Design Center on the left side menu.

Here you have a few options to create a new API. Select New API Spec. This will help you to design your API specification using RAML.

Give it a name and click Create API Spec. Then you will see the API Spec designer window. Here you can write the specification using RAML.

You can copy and paste the following RAML specification to understand how it generates the API document.

You will see the API doc is getting created while you are writing the code. This is very easy compared to most the API documentation tools.

Then we have to use that API specification to design the real API endpoints. To do that, we can use The API Manager. Click on the API Manager link on the left side menu bar.

After designing the API specification, simply publish it. It will be shared only within your organization.

Then you can mention the version o the API and whether it’s in the stable stage or development stage.

Home view of your Anypoint Platform™ account

Click on Add New API. We are going to create a new API from the scratch. Anyway, you can upload a RAML file if you’ve created one already.

Then select Mule Gateway to create an API gateway from the API specification you created in the steps above.

Then you can assign previously created API specifications like this. Anyway, in this step, you can start designing a new API endpoint as well. Select “MyFirstAPISpecification” we created.

Now, it’s time to specify the endpoint. Here the URI is optional. Anyway if you have an endpoint integrated with AnyPoint, you can add it here. For learning purpose, let’s continue without adding anything here.

Now, review whether your API is correct or not.

Now you will see the documentation of the new API you created. Here you can see Key Metrics like Latency, Requests, and Top Apps.

Click on “View API in Exchange” to see how it’s visible to your organization. You can share your API endpoints and API specifications like this with other developers. It’s easy to use, easy to maintain, and easy to test each API endpoint before integrating with your apps.

In this tutorial, I will not discuss how we can use this to do an actual integration. I will publish the next version of this tutorial on how to integrate MuleSoft AnyPoint with your servers and how to integrate apps with your API integrator.

I have a few more RAML file samples in the following repository. Your contributions are also valuable. Please fork the project and send me your contributions.

Thank you!

You can support me by buying a coffee ☕️ here https://www.buymeacoffee.com/asirihewage



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store