Hello World REST API in mule

 

In this tutorial we will demonstrate how to create a simple Hello World REST API in mule and deploy the project on Mulesoft runtime environment

Create Project in Anypoint Studio as Mule Project – HelloWorld

Hello World - REST API In Mule

 

Click Finish and Project is now created. Drag and drop HTTP component

Hello World - REST API In Mule

 

Click on + button to define the endpoint configuration

 

Configure the Port to 8081 – here we will access the service on 8081 port

Hello World - REST API In Mule

 

Define the path as

 

And the no error text will be shown on the top

 

Drag and Drop Set Payload activity

 

Update the Value as Hello #[message.inboundProperties.’http.query.params’.name]

 

Run the project

 

 

Application will start in Default domain

Hello World - REST API In Mule

 

Open Chrome or any browser and hit –

http://localhost:8081/sayhello?name=World

you will see the response as below and here we are passing name as query parameter and as per the logic in mule service, Hello will be prepend to the parameter value

  
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:
Subscribe
Notify of
guest
1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Anil
Anil
2 years ago

Your hard work is well appreciated. Please update the content to the latest version as few examples are still written in3.9 version instead of version 4. Thanks.