Mirth Community

Mirth Community (http://www.mirthcorp.com/community/forums/index.php)
-   Support (http://www.mirthcorp.com/community/forums/forumdisplay.php?f=6)
-   -   Get Token from destination response and pass to new Channel in Mirth (http://www.mirthcorp.com/community/forums/showthread.php?t=216575)

user1411 10-12-2016 11:42 PM

Get Token from destination response and pass to new Channel in Mirth
 
I've created a channel in Mirth which first calls authentication service and returns response. Source I've configured to HTTP Listener and in destination I've used HTTP Sender which calls a rest service for login and returns token as below.

{"token":"5912aa99-af21-5614-c232-d22be9e5c102","app":"TEST API Suite","expires":845,"userID":"ZCT06D123Cfk20oROB9 x-bEXeY12oQGfack6dMMc-0o="}

Question: From the response that I'm receiving from rest service , how do I extract the token part and then pass that token to another channel and use it for calling another service.

Please Help. I'm a Newbie in Mirth. Thanks.

narupley 10-13-2016 07:00 AM

Open up the response transformer and set your response data types to JSON. Post that sample payload in the inbound template, then you can easily create a Mapper step to extract the token and store it in the channel map.

Then you can use a subsequent Channel Writer destination, and in the Message Metadata table include the name of the variable you created.

user1411 10-15-2016 04:26 AM

Thanks a lot for your help. I used global variable map for setting that variable. And got that variable in another channel as I wasn't able to figure out how to get/use Message Metadata table

siddharth 10-17-2016 03:46 AM

If you did capture your response in a variable from the response as discussed above, then just drag and drop that variable in the Message Metadata box of the channel writer destination.

It is just above the Template Box. Also has a tool-tip to it.


All times are GMT -8. The time now is 02:30 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Mirth Corporation