Using CAPI with PowerShell

CAPI endpoints can be executed via PowerShell (PS) by using the Invoke-WebRequest cmdlet. In order to so, you will need to use a version of PS that includes an Invoke-WebRequest overload accepting an Authentication parameter (PS version 7 or above). You can redirect the returned content to a file with the OutFile parameter.

Authentication

To reach a CAPI endpoint that requires authentication, execute Invoke-WebRequest specifying the URL of the endpoint while setting the Authentication type to Basic and passing a PSCredential.

HTTP POST Method

Invoke-WebRequest can execute HTTP POST methods by specifying Method type POST and including data in the Body parameter as a set of key/value pairs.

Related

For additional information regarding Invoke-WebRequest, please refer to Microsoft Docs.