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

Notifications

Announcements

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 Super User 2025 Season 2 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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard