I have a long-running post request to a rest endpoint which might take a few minutes to finish and I need the response from it to start another
I have tried using Invoke-RestMethod
and Invoke-WebRequest
but both seem to not be able to track the request after it has finished unlike when I send the request from something else other than PowerShell.
What is happening is the script looks like its waiting for something but it doesn't matter howling I wait for nothing comes back!
All I found was a suggestion to include -DisableKeepAlive
but that didn't help even though the documentation seems to be the opposite of what I need!
I did get a response after a long time but only happened once! using the following
Invoke-RestMethod -Method post -DisableKeepAlive -ContentType 'Application/Json' -Uri https://localhost/api/import
Any suggestions? is this even possible? Or do I need to take a different approach?