Skip to main content

Notifications

Community site session details

Community site session details

Session Id : KY5P/DnuA7y2J0F9AAGd8t
Power Automate - Using Flows
Suggested answer

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

Like (1) ShareShare
ReportReport
Posted on 29 Jul 2024 03:41:45 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.
  • mikraphne Profile Picture
    46 on 30 Jul 2024 at 13:29:05
    Looking to download a file via HTTP GET, then send the file to an HTTP POST
    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:
  • Suggested answer
    NsL Coder Profile Picture
    469 Super User 2025 Season 1 on 29 Jul 2024 at 04:42:38
    Looking to download a file via HTTP GET, then send the file to an HTTP POST
    Try this:
    base64ToString(body('Download_File')?['$content'])

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Automate - Using Flows

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 9 Super User 2025 Season 1

#2
rzaneti Profile Picture

rzaneti 7 Super User 2025 Season 1

#3
lbendlin Profile Picture

lbendlin 4 Super User 2025 Season 1

Overall leaderboard

Featured topics

Restore a deleted flow
Loading started