MuleSoft API lifecycle – Use Case


As we already walked through the MuleSoft API lifecycle theory so now it’s time to start with the actual MuleSoft API lifecycle – Use Case.

Requirement – Mobile team come with a requirement that they need an interface which can accept the order placed from the mobile application and can also provide the user’s order details in case they need at any time.

NFR (Non Functional Requirement) – Mobile team want to use basic authorization for calling the service and the response should be in 5 sec max.

MuleSoft team/consultant looks into the requirement and will start with the API specification. Here team needs to provide interface for order management. API will provide user’s order information and accept the user’s placed order.


MuleSoft API lifecycle – Use Case


API Designer – We start with we create order-mgmt-api project in design center.

Click on create new and fill in the details

MuleSoft API lifecycle – Use Case


First we create the types.raml which will hold the type details which we are going to use in api RAML

MuleSoft API lifecycle – Use Case


Second we create the api RAML which will hold the API specification

MuleSoft API lifecycle – Use Case

Specification will hold order resource which will have GET and POST method

GET will take the user id as query parameter and provide user order details

POST will take the user id and item details which need to create in order management system

Both methods will be secured through basic authentication

Download the Sample order-mgmt-api


Mock Service – Once we are done with the API specification then we enable the Mocking Service button


API base URI will be generated which can be tested through and API testing client like POSTMAN or SOAPUI

Select GET method and click on try it

Provide dummy userid and basic authorization details


Then we can see the 200 response as well


API Console – This console is generated by default by the API Kit router configuration. Once application is deployed to mule runtime then this console is available. Will show this when we generate source code for the application.

Till now is a recursive process where we keep on validating the RAML design/specifications with clients/vendors and based on the feedback either we again follow the process (RAML design -> Mocking Service -> Validate) or move ahead with development

When we received the positive feedback from clients/vendor we move to Develop and Testing phase.


Develop –Anypoint Studio can directly download the API Specification (RAML) from design center and create a base mule application

Select File -> New -> Mule Project


Select “From Design Center or Local files”


Select the order-mgmt-api from the selection box and click OK

Provide the project name and click Finish

This will create a mule application with basic skeleton


With both GET and POST method flows, based on the RAML specification

And API console code

Testing – when we are done with the development and add the required logic in our mule application. We have to write the MUNIT to make it sure that future changes will not break the existing logics.

We can select the flow and create the MUNIT for the flow

This will create the MUNIT for the flow which we can update as per our assertion logic


Download sample mule application project – order-mgmt-api


Runtime Manager – Once we are done with the development and MUNIT, then we can deploy our code to mule runtime. We will deploy our code to Cloudhub.

Login to Anypoint Platform and go to Mule Runtime Manager

First export the project jar which can be deployed to Cloudhub

Select the project -> export


Click Next

Please select “include project modules and dependencies” as we have to deploy the same project on Cloudhub

A Jar will be exported which can be deployed on Cloudhub


On Anypoint Platform – Select Runtime Manager


Click on Deploy application

Provide the appropriate name and deploy the application


Once deployed we can test the API

MuleSoft API lifecycle – Use Case

To test the API we need to create the URL which needs to be called

Click on dashboard

Select the domain name

MuleSoft API lifecycle – Use Case

HTTP will be as per the configured Listener in mule application – click on edit in Anypoint Studio

MuleSoft API lifecycle – Use Case


MuleSoft API lifecycle – Use Case

We can see here the default listener is HTTP

Remaining information we can get from path and RAML

MuleSoft API lifecycle – Use Case + RAML resource

MuleSoft API lifecycle – Use Case

So effective URL is

Add the query parameters

When we test the API it will show the result

MuleSoft API lifecycle – Use Case

But we are still missing something, it still not secure as we are not providing basic authorization details. To add security, MuleSoft come with OOTB functionality called API Manager to easily secure the APIs.


API Manager – To apply policy in API Manager we have to add Auto Discovery details, please go through Auto Discovery tutorial to know the same.

Assuming now you know how to add Auto Discovery, we start the API Manager configuration by pushing the RAML from Design Center to Exchange


Click on Publish and then Publish to Exchange


MuleSoft API lifecycle – Use Case

In Exchange now we can see the Asset


Now we move to API Manager and create the required configuration and add the Auto Discovery details

MuleSoft API lifecycle – Use Case

Once application deployed using Auto Discovery details, API Manager configuration will come in Active state from Unregistered state

MuleSoft API lifecycle – Use Case

Add the Client id enforcement policy

MuleSoft API lifecycle – Use Case

Now if we hit the same URL – we can see the API is asking for basic authorization

if not provided we will get below error


Will raise the client authentication request from Exchange

MuleSoft API lifecycle – Use Case

After providing the authorization details we can call the API successfully

MuleSoft API lifecycle – Use Case

Anypoint Analytics – This is replaced with Anypoint Monitoring and Visualizer in current Anypoint Platform. For the Developer account we don’t have access to enable and show it here.

MuleSoft API lifecycle – Use Case


API Exchange – as a part of API Manager Configuration we add the Design Center project to Exchange. This will help the organization and connected partners to discover existing APIs as per their needs.

We also update the Exchange asset to include more meaning full information which can talk about the asset

MuleSoft API lifecycle – Use Case


With this we end the API Lifecycle

API Lifecycle will not stop here and again go into next lifecycle based on the feedback.

E.g. Existing Order management APIs are not capable enough to handle customize items, so based on this new requirement a new set of API version e.g. 1.0.1 is created.

Thank you for taking out time to read the above post. Hope you found it useful. In case of any questions, feel free to comment below. Also, if you are keen on knowing about a specific topic, happy to explore your recommendations as well.
For any latest updates or posts on our website, you can follow us on LinkedIn. Look forward to connecting with you there.

Share this:
Notify of
Newest Most Voted
Inline Feedbacks
View all comments
3 years ago

simple and easy explaination. Clearly understood. Thank you

3 years ago

simple sentences through out the course to understand topics easily

3 years ago

Very much help full content and simple great work

1 year ago

Best place to revise/reconstruct and correct your concepts