web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Looking to download a ...
Power Automate
Suggested Answer

Looking to download a file via HTTP GET, then send the file to an HTTP POST

(1) ShareShare
ReportReport
Posted on by 46
I have been banging my head against the wall with this one for about a week now, mostly because it is the very last step I need to complete my flow. 
 
To explain a bit about the process, I am attempting to use a feature in Defender 365 called Live Response, which allows you to run scripts and grab files off of a machine. In my case, I am hoping to grab files that would be flagged as possible malware, and I have it to the point where I can kick it off and it grabs the file, then gives me a URL to download the file from. I am using an HTTP GET to download the file:

 
I then want to take this file and send it off to my malware sandbox that I have sitting in another environment. The problem is, Defender names the file filename.txt.gz, like so:

 
Not only is it a .txt.gz, but the content-type is "application/ocet-stream".
 
I am not sure that the.txt is messing things but when it pops an error for Unsupported media type, it mentions text/plain "in request":
The 'Body' is from the Download_file action, and the fileName is just a variable from where I parse out the original filename. Not being sure if the filename (which does have .txt in it) is causing issues, I actually hardcoded it to be named test.gz, and it still threw the same 'Unsupported Media type' error that mentions text/plain, so I am not sure where it is getting that.

The Input to the HTTP POST action. ends up looking like this:
Being that the contents of this file are just a .txt file that I am testing with the text "asdfasdf", I already can tell that this is the archive content that it is seeing, which makes sense as to why the characters look all funky.
 
Coming from the cybersecurity side of things, I have yet to throw together a Logic App that is doing this much stuff and jumping between systems, so it is probably just the way that I am trying to do this. I've seen a handful of different ways to do similar things but have tried so many of them with no luck and am getting a b bit discouraged at this.
Categories:
I have the same question (0)
  • Suggested answer
    NsL Coder Profile Picture
    475 Moderator on at
    Try this:
    base64ToString(body('Download_File')?['$content'])
  • mikraphne Profile Picture
    46 on at
    Unfortunately, I am getting the same exact results after trying the suggestion.

     
    Also, strange thing is that when I set this up as a function, I can save it and it looks totally fine. However, when I save, then go back to the Designer view, it doesn't have the base64ToString part in it anymore..

    Before Saving:

    After Saving and refreshing:

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 636

#2
Valantis Profile Picture

Valantis 372

#3
11manish Profile Picture

11manish 335

Last 30 days Overall leaderboard