Rest API powershell error in password manager pro

Rest API powershell error in password manager pro

Hi, I am trying to create a script for accessing user accounts in PMP.
I am trying first to access the resources for the API user.

I have tried below script :
==========================================================
add-type @"
using System.Net;
using System.Security.Cryptography.X509Certificates;
public class TrustAllCertsPolicy : ICertificatePolicy {
public bool CheckValidationResult(
ServicePoint srvPoint, X509Certificate certificate,
WebRequest request, int certificateProblem) {
return true;
}
}
"@

[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy

Invoke-RestMethod -Uri " https://servername/restapi/json/v1/resources?AUTHTOKEN=xxxx" -Method GET
============================================

I am getting error :

Invoke-RestMethod : The underlying connection was closed: An unexpected error occurred on a send.

Tried the url on browser . getting response successfully however getting no success on the powershell script.

If you have got any idea about the error.
Thanks in advance

                  New to ADSelfService Plus?