Download file from remote server

Questions and answers on designing your Servoy solutions, database modelling and other 'how do I do this' that don't fit in any of the other categories

Download file from remote server

Postby jdbruijn » Tue Apr 05, 2022 3:01 pm

Hi,
I've got an API that retrieves a download link for a pdf file from an external party using an API, and I have to pass that file along as the response to another application. The external party returns the file URL in the response body and I want to download it to the server so I can pass it along in the response of my API.
Jos de Bruijn
Focus Feedback BV
Servoy Certified Developer
Image
jdbruijn
 
Posts: 492
Joined: Sun Apr 11, 2010 6:34 pm

Re: Download file from remote server

Postby mboegem » Tue Apr 05, 2022 5:17 pm

I guess your question is: how to do this?

Can't you create a GET request with the download link using the HTTP plugin?
Once you get the response, you can get the media data from the response, this should be a byteArray.

Then start a second request to send the file to the other application.

Hope this helps
Marc Boegem
Solutiative / JBS Group, Partner
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance Developer

Image

Partner of Tower - The most powerful Git client for Mac and Windows
User avatar
mboegem
 
Posts: 1742
Joined: Sun Oct 14, 2007 1:34 pm
Location: Amsterdam

Re: Download file from remote server

Postby jdbruijn » Wed Apr 06, 2022 8:44 am

Hi Marc,
Yes that works, thanks!
Did not see the getMediaData for the response. I was looking for a download file option.
Jos de Bruijn
Focus Feedback BV
Servoy Certified Developer
Image
jdbruijn
 
Posts: 492
Joined: Sun Apr 11, 2010 6:34 pm


Return to Programming with Servoy

Who is online

Users browsing this forum: No registered users and 12 guests