Retrieve Query Parameters from Http Url

 

Create a project in Anypoint studio and configure the listener to retrieve Query Parameters from HTTP URL

We will pass the Name and EmpId as query parameter.

http://localhost:8081/retrieveQueryParams?Name=John&EmpId=123

Drag and drop transform message and write Dataweave expression

Retrieve Query Parameters from HTTP URL

Dataweave expression:
%dw 2.0
output application/json
---
{
  "Name":attributes.queryParams.Name,
  "EmployeeId":attributes.queryParams.EmpId
}

Deploy the project and run in debug mode and trigger the request

You can see the screenshot below query parameters, headers, uri parameters are part of attributes

Retrieve Query Parameters from HTTP URL

 

Test the application from SOAP UI

 

Sample application: retrievequeryparameters sample application

  
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
0 Comments
Inline Feedbacks
View all comments