Rest API internal error from request

I need a solution

Hello, I need help with figure out my problem. 

Every time when I try to communicate via rest api to SEPM, I have respone in html form with message: “The request resulted in an internal error.”

Script in powershell:

[System.Net.ServicePointManager]::ServerCertificateValidationCallback = { $True }
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

$credentails = Get-Credential -UserName “UserName” -Message “Message”
$cred= @{
username = $credentails.UserName
password = $credentails.Password
domain = “”
}
#converts $cred array to json to send to the SEPM
$auth = $cred | ConvertTo-Json
$Authnet = Invoke-RestMethod -Uri https://SEP_ADD:SEP_PORT/console/apps/sepm/api/v1/… -Method Post -Body $auth -ContentType “application/json”
$access_token = $Authnet.Token

#format HTTP header
$header = @{Authorization=’Bearer ‘+$access_token}

#Lists All groups
Invoke-RestMethod -Method Get -Uri https://SEP_ADD:SEP_PORT/console/apps/sepm/api/v1/… -Headers $header

—————

Variable $access_token is empty because $Authnet have only error message. Certificate trusted. Somewhere I saw similiar problem, and the solution probably was changing something in administrator lockout account policies, but it is really possible that was solution?

Any ideas?

0

Related:

  • No Related Posts

Leave a Reply