No announcement yet.

Get Token from destination response and pass to new Channel in Mirth

  • Filter
  • Time
  • Show
Clear All
new posts

  • 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.

  • #2
    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.
    Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

    Nicholas Rupley
    Work: 949-237-6069
    Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.

    - How do I foo?
    - You just bar.


    • #3
      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


      • #4
        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.
        HL7v2.7 Certified Control Specialist!