Announcement

Collapse
No announcement yet.

Acess to Mirth REST API

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Acess to Mirth REST API

    Hello everyone,

    i'm creating this post just to share a piece of "code" regarding the Mirth REST API.
    I wanted to access the Mirth REST API services, using the Mirth itself but, with no success because of the SSL Certificate.

    So, i develop a external .jar which can handle that perfectly, and just need to include it on the Mirth custom-lib folder.
    I don't know if anyone face the same situation, or anyone would like to have access to those services, which are super great, using Mirth, so
    that is why I'm sharing this.

    Just copy the attached .jar file to the custom-lib folder in Mirth directory, and restart Mirth Service.
    Then, on Mirth just need to create a new channel, WebService Listener, and choose the custom webservice that is on the custom-lib folder.
    Then is just use it and invoke the operations that you need.

    For now, i just made 6 operations, which are:

    - login
    - logout
    - get channels
    - get server version
    - get server status
    - get users

    For each operation, first we need to login to get the cookie response from that. Just after getting this cookie, then yes, we can invoke the rest of the operations. This is not my invention, but yes a "must" from Mirth REST API, which i obviously agree for security purposes.

    Attachments:
    • mirth.customws.jar - the jar file to put on custom-lib folder

    • WS_Test.xml - channel that create a "workflow" to call all the operations needed, managing the cookie from login (login->get channels->logout, etc)

    • Master_WS.xml - the channel that exposes the .jar service to call the Mirth REST Services


    Just use, and give feedback please.

    Thank you
    Attached Files
    Best Regards,
    Alex Neiva

  • #2
    Thank you so much for sharing Alexandre!

    I was in trouble when I started to work with API.
    Now testing with .NET platform. I attached some screenshots from my testing stage.
    Attached Files

    Comment


    • #3
      Hello,

      what is your print screens? looks awesome
      Looks like a Mirth but with a different theme and different functionalities...
      How you are getting all that info?
      Best Regards,
      Alex Neiva

      Comment


      • #4
        with the REST API

        Comment


        • #5
          And you are accessing the REST API using .NET?
          I try that but with no success!
          Best Regards,
          Alex Neiva

          Comment


          • #6
            Yes using .NET and you don't need config SSL stuff at Mirth. Another thing is you don't need a channel. I just communicate with the REST API as it should be.

            Comment


            • #7
              That what i wanted but with no success using .NET! I got errors regarding the certificate and other stuff.
              Can you post or send me some example code that you are using .NET to invoke the Mirth REST API?

              Thank you
              Best Regards,
              Alex Neiva

              Comment


              • #8
                Originally posted by AlexNeiva View Post
                I wanted to access the Mirth REST API services, using the Mirth itself but, with no success because of the SSL Certificate.
                From within mirth, you can simply use the mirth client for that. It encapsulates all the low-level handling and provides easy access to all needed components of a remote mirth instance.

                Check this thread for an example of using the mirth client.

                Comment


                • #9
                  Sorry for rumbling the topic.
                  I will open a different thread for this and I will share my experience.

                  Originally posted by AlexNeiva View Post
                  That what i wanted but with no success using .NET! I got errors regarding the certificate and other stuff.
                  Can you post or send me some example code that you are using .NET to invoke the Mirth REST API?

                  Thank you

                  Comment


                  • #10
                    Oh that would be great obsessio...
                    Thank you. I will be waiting for it

                    Originally posted by obsessio View Post
                    Sorry for rumbling the topic.
                    I will open a different thread for this and I will share my experience.
                    Best Regards,
                    Alex Neiva

                    Comment


                    • #11
                      Thank you odo for your response... but what i really want is use .NET to call Mirth REST API.

                      Originally posted by odo View Post
                      From within mirth, you can simply use the mirth client for that. It encapsulates all the low-level handling and provides easy access to all needed components of a remote mirth instance.

                      Check this thread for an example of using the mirth client.
                      Best Regards,
                      Alex Neiva

                      Comment


                      • #12
                        Originally posted by AlexNeiva View Post
                        Thank you odo for your response... but what i really want is use .NET to call Mirth REST API.
                        Oh, ok - it seems I got you wrong, as I was referring to your initial post:

                        Originally posted by AlexNeiva View Post
                        I wanted to access the Mirth REST API services, using the Mirth itself but, with no success because of the SSL Certificate.
                        This is possible with the approach I mentioned.

                        Comment


                        • #13
                          Sorry for the late answer.
                          Here is the sample.


                          Originally posted by AlexNeiva View Post
                          That what i wanted but with no success using .NET! I got errors regarding the certificate and other stuff.
                          Can you post or send me some example code that you are using .NET to invoke the Mirth REST API?

                          Thank you
                          Originally posted by AlexNeiva View Post
                          Oh that would be great obsessio...
                          Thank you. I will be waiting for it

                          Comment


                          • #14
                            I received this error while importing the WS_Test channel.
                            Appliance Version 3.11.3
                            Mirth Connect Version 3.7.0

                            Would you mind uploading current versions of the 2 mirth channels?

                            Channel "WS_Test" is invalid. Original cause:
                            No such field com.mirth.connect.model.ChannelProperties.channelV isibility
                            ---- Debugging information ----
                            field : channelVisibility
                            class : com.mirth.connect.model.ChannelProperties
                            required-type : com.mirth.connect.model.ChannelProperties
                            converter-type : com.mirth.connect.model.converters.MigratableConve rter
                            path : /channel/properties/channelVisibility
                            -------------------------------
                            com.thoughtworks.xstream.converters.reflection.Abs tractReflectionConverter$UnknownFieldException: No such field com.mirth.connect.model.ChannelProperties.channelV isibility
                            ---- Debugging information ----
                            field : channelVisibility
                            class : com.mirth.connect.model.ChannelProperties
                            required-type : com.mirth.connect.model.ChannelProperties
                            converter-type : com.mirth.connect.model.converters.MigratableConve rter
                            path : /channel/properties/channelVisibility

                            Comment

                            Working...
                            X