HTTP requests from JavaScript #5157
-
I've got configuration data stored on a FHIR server, and I'd like to pull that into Mirth to use in my transformer, but I can't figure out how to do it. The fetch() method and XMLHttpRequest class don't seem to be supported in the Mirth Javascript environment. The call I'd like to make is a GET to https://fhirserver/ConceptMap. (I probably could use HTTP instead of HTTPS, if necessary.) I'd like to execute this during the channel deploy so that the information is available when the messages start flowing. I'm using the free version of Mirth 4.0.0. Any suggestions? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
If you want a transformer to make a http call you have to do that in java. There are examples in the forums for that. As an alternative, and if the config data is persistent and might be used by more than one channel, you might consider using a single channel to source that configuration data and store it in a global map as an object. The source tab can just be a JS reader that "returns true". In your destination, call the FHIR endpoint and in the response transformer assign the values needed to a $g object. Then reference that object as needed anywhere in any channel. |
Beta Was this translation helpful? Give feedback.
If you want a transformer to make a http call you have to do that in java. There are examples in the forums for that.
As an alternative, and if the config data is persistent and might be used by more than one channel, you might consider using a single channel to source that configuration data and store it in a global map as an object.
The source tab can just be a JS reader that "returns true". In your destination, call the FHIR endpoint and in the response transformer assign the values needed to a $g object. Then reference that object as needed anywhere in any channel.