Trying to reply about using powershell’s invoke-webrequest and getting an unexpected file type, but having some delays getting added to the group and wanted to give you a timely response.
There are a few things that could be going on, you’ll need to do a bit more digging to figure it out. I’ll start by suggesting a tool (Postman) and giving a bit of context into what’s probably going on.
This is what an http conversation actually looks like. Red is what we send, blue is what we get back.
Here’s a practical example in postman (calling out to google.com)
Notice there’s 2 places we can send parameters, in the URI and in the Headers. One of the standard headers is Content-Type which indicates the format the web server is trying to send back to you.
Try installing Postman, putting in your URI and playing around values you send in the URI and Headers, there’s probably a way to ask for it to send a text/plain instead of text/html file. Once you know what the URI and Headers need to be you should be able to translate your request into powershell code using the -URI and -Headers parameters