Over a million developers have joined DZone.

Posting JSON Data to a Mule Flow

DZone's Guide to

Posting JSON Data to a Mule Flow

There are only 11 steps to POSTing JSON data to a Mule flow. JSON data can be sent directly to a Mule flow. The reason for doing this is to access data from a payload.

· Integration Zone ·
Free Resource

Building integrations to CRM applications? Find out eight things that each product manager and technical executive should know in The CRM Integration Guide: 8 Things Experts Are Considering in Their API Strategy.

This is an example that showcases how data in JSON format can be sent directly to a Mule flow. The JSON data can be accessed using the Mule expression language inside the flow.

We will keep the flow simple, as accessing the data from the payload is the reason for this example.

11 Steps to POSTing JSON Data to a Mule Flow

  1. Open Anypoint Studio.

  2. Create a new Mule project. Click File > New > Mule Project.

  3. Name the project JsonAccess and click Finish.

  4. Drag the HTTP Connector from the palette onto the canvas. Click HTTP connector to open the properties window as shown below:Connector Setting Initial

  5. Click + to enter the connector settings.Connector Configuration Detail

  6. Click OK. Now add POST against Method so that only POST is allowed on /.Connector Setting

  7. Drag Logger from the palette next to the HTTP connector on the canvas. Click Logger the on canvas and enter #[json:productid] as the value for the Message.logger details

  8. Save and your run project.

  9. Open Postman. Prepare the request as shown in the image below:Image titleMake sure POST is selected as the method. Under the Body tab, choose raw and change mime to JSON (application/json). The content which we willPOST is {"productid":"6","productname":"Shampoo"}.

  10. Click Send. Go back to Anypoint Studio.

  11. Under Console, we can see the logger output as 6:Image title


We have successfully POSTed JSON data in the request body from Postman to the Mule application!

Your API is not enough. Learn why (and how) leading SaaS providers are turning their products into platforms with API integration in the ebook, Build Platforms, Not Products from Cloud Elements.

mule ,json ,tutorial ,integration ,post ,payload

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}