invoke-webrequest

cURL to Invoke-Webrequest command

◇◆丶佛笑我妖孽 提交于 2020-01-15 13:36:48
问题 Can anyone give me a hint, how to convert following curl command to PS Invoke-Webrequest ? curl -d {\"password\":\"$password\"\} $vault/v1/auth/userpass/login/${login,,} I have some thoughts on this, but cannot figure out, how to finish this: $vault="3.3.3.3:8500" $pair = (Get-Credential) $params = ???? $login = $pair.getNetworkCredential().username $pass = $pair.getNetworkCredential().password Invoke-WebRequest $url -Method Post -Credential $pair -Body $params -UseBasicParsing How to

cURL to Invoke-Webrequest command

此生再无相见时 提交于 2020-01-15 13:35:11
问题 Can anyone give me a hint, how to convert following curl command to PS Invoke-Webrequest ? curl -d {\"password\":\"$password\"\} $vault/v1/auth/userpass/login/${login,,} I have some thoughts on this, but cannot figure out, how to finish this: $vault="3.3.3.3:8500" $pair = (Get-Credential) $params = ???? $login = $pair.getNetworkCredential().username $pass = $pair.getNetworkCredential().password Invoke-WebRequest $url -Method Post -Credential $pair -Body $params -UseBasicParsing How to

Range Header Must Use Appropriate Property or Method

孤街醉人 提交于 2019-12-23 04:39:06
问题 I've searched high and low and asked on the product forums, but cannot seem to figure this out. Using PowerShell 5 I'm attempting to limit my results by using a range header in the way the API documentation indicates. However, I receive the following error when I try to use it. "The 'RANGE' header must be modified using the appropriate property or method. Parameter name: name" I've tried: $headers = @{ SEC= $apiKey range="items=0-49" } $result = Invoke-RestMethod -Method get -Uri $global:URI