Issue:
I can not get content by invoke-webrequest to access nextcloud API but I can get content by curl in CMD. I don’t know why.
Powershell command
$uri = “https://nc-demo1.murata.com.cn:7441/ocs/v2.php/apps/files_sharing/api/v1/shares”
$headers = @{
“OCS-APIRequest” = “True”
}
$password = ConvertTo-SecureString “PPPPPP” -AsPlainText -Force
$Cred = New-Object System.Management.Automation.PSCredential (“”, $password)
Invoke-WebRequest -Uri $uri -Method ‘Get’ -Headers $headers -Credential $Cred -Verbose
CMD Command
curl -u :pppppp -X GET https://nc-demo1.murata.com.cn:7441/ocs/v2.php/apps/fil
es_sharing/api/v1/shares -H “OCS-APIRequest: true”