For a webrequest in PowerShell I use
Invoke-WebRequest -Uri 'https://www.it-takes-long.de' -UseBasicParsing
Is there a way to do a webrequest in a fire and forget way?
I call the url to warm up a web from my build server and I would rather continue to the next step and not wait for the web to start up.
The Invoke-WebRequest cmdlet sends HTTP and HTTPS requests to a web page or web service. It parses the response and returns collections of links, images, and other significant HTML elements. This cmdlet was introduced in PowerShell 3.0.
To call a REST API from the Windows PowerShell, you should use the Invoke-RestMethod cmdlet. A call to an API is simply a request through HTTP or HTTPS. So, you will need a URL to which the API will be sent. You can find detailed information about the URL to call to get data from API documentation.
Invoke-WebRequest sends a request to the URI (Uniform Resource Identifier) which is also called Endpoint and retrieves the data from the Web Page. It directly works with the URL or with the REST API because some websites allow modifying the content using only APIs.
Just put the invoke into a job using the Start-Job
cmdlet:
Start-Job -ScriptBlock {Invoke-WebRequest -Uri 'https://www.it-takes-long.de' -UseBasicParsing}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With