web stats
HTTP Sender - Send file - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Thread Tools Display Modes
Old 12-17-2019, 10:23 PM
benyssen benyssen is offline
OBX.1 Kenobi
Join Date: Sep 2010
Posts: 38
benyssen is on a distinguished road
Default HTTP Sender - Send file


I have to send data and a file from an HTTP post.
I use MirthConnect version 3.8.1.

In my connector 'HTTP Sender', how can I prepare the 'Content' with my data and my file?

I have a look in threads, but no post could really help me...

Thanks you for your help

Reply With Quote
Old 02-04-2020, 06:03 AM
con con is offline
OBX.1 Kenobi
Join Date: Nov 2018
Location: Berlin
Posts: 42
con is on a distinguished road

HTTP SENDER -> in the Destination Transformer:

var contents = FileUtil.readBytes('C:\\yourpath\\' + $('FILELINK')); //here I take the Filename from the source mapping
var contents64 = FileUtil.encode(contents);

logger.debug("SIZE OF FILE: " + $('FILELINK') + " = " + contents.length);

var mapping;

try {
	mapping = contents64; 
} catch (e) {
	mapping = '';

channelMap.put('FileBase64', validate( mapping , '', new Array()));
your URL, for example:

http://yourserver:yourport/yourlink.web.api/yourmethodstring?yourparameter=yourparametervalue& parameter.item.name=${FILELINK}&parameter.flags=.. . (you get this from the documentation or swagger)

fill your headers correct (Athentification/Accept) depends on the webservicedocumentation and preferences)

Method POST

Data Type: Binary

Content: ${FileBase64}

think about customized response handling, if you need advanced error handling
Work for a NPO health care provider in Berlin
  • Current Version of MC with the onboard MySQL Database on a Windows Server 2012 R2
Reply With Quote

http sender, post

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 03:18 AM.

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