web stats
Acess to Mirth REST API - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 02-20-2018, 11:29 AM
AlexNeiva AlexNeiva is offline
Mirth Guru
 
Join Date: Oct 2013
Location: Portugal
Posts: 277
AlexNeiva is on a distinguished road
Post 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
File Type: xml Master_WS.xml (9.9 KB, 36 views)
File Type: xml WS_Test.xml (30.9 KB, 43 views)
File Type: jar mirth.customws.jar (10.9 KB, 26 views)
Reply With Quote
  #2  
Old 02-21-2018, 03:44 AM
obsessio obsessio is offline
OBX.3 Kenobi
 
Join Date: Mar 2015
Location: Turkey
Posts: 166
obsessio is on a distinguished road
Default

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 Images
File Type: jpg 2.jpg (30.9 KB, 75 views)
File Type: jpg 3.jpg (391.0 KB, 53 views)
File Type: jpg 4.jpg (458.6 KB, 37 views)
File Type: jpg 6.jpg (216.0 KB, 33 views)
File Type: jpg 7.jpg (407.9 KB, 38 views)
Reply With Quote
  #3  
Old 02-21-2018, 03:50 AM
AlexNeiva AlexNeiva is offline
Mirth Guru
 
Join Date: Oct 2013
Location: Portugal
Posts: 277
AlexNeiva is on a distinguished road
Default

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?
Reply With Quote
  #4  
Old 02-21-2018, 04:01 AM
obsessio obsessio is offline
OBX.3 Kenobi
 
Join Date: Mar 2015
Location: Turkey
Posts: 166
obsessio is on a distinguished road
Default

with the REST API
Reply With Quote
  #5  
Old 02-21-2018, 04:04 AM
AlexNeiva AlexNeiva is offline
Mirth Guru
 
Join Date: Oct 2013
Location: Portugal
Posts: 277
AlexNeiva is on a distinguished road
Default

And you are accessing the REST API using .NET?
I try that but with no success!
Reply With Quote
  #6  
Old 02-21-2018, 04:58 AM
obsessio obsessio is offline
OBX.3 Kenobi
 
Join Date: Mar 2015
Location: Turkey
Posts: 166
obsessio is on a distinguished road
Default

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.
Reply With Quote
  #7  
Old 02-21-2018, 05:05 AM
AlexNeiva AlexNeiva is offline
Mirth Guru
 
Join Date: Oct 2013
Location: Portugal
Posts: 277
AlexNeiva is on a distinguished road
Default

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
Reply With Quote
  #8  
Old 02-21-2018, 05:10 AM
odo odo is offline
OBX.3 Kenobi
 
Join Date: Feb 2017
Location: Luxembourg
Posts: 140
odo is on a distinguished road
Default

Quote:
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.
Reply With Quote
  #9  
Old 02-21-2018, 06:01 AM
obsessio obsessio is offline
OBX.3 Kenobi
 
Join Date: Mar 2015
Location: Turkey
Posts: 166
obsessio is on a distinguished road
Default

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

Quote:
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
Reply With Quote
  #10  
Old 02-21-2018, 06:31 AM
AlexNeiva AlexNeiva is offline
Mirth Guru
 
Join Date: Oct 2013
Location: Portugal
Posts: 277
AlexNeiva is on a distinguished road
Default

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

Quote:
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.
Reply With Quote
Reply

Tags
custom jar, custom webservice, rest api, rest service

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 06:00 AM.


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