Consult list of servers through the API

Consult list of servers through the API

Hello, I need to do something very simple, such as query the list of servers in the PatchManager system through the API. To do this, I wanted to ask you if you have an example of how to authenticate and then make the query. What I have is the following, but I can't authenticate.

Powershell script

[System.Net.ServicePointManager]::ServerCertificateValidationCallback = { $true }
$username = "username"
$password = "passworddd"
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes("$($username):$($password)"))

$headers = @{
    Authorization = "Basic $base64AuthInfo"
}

$token = $response.message_response.auth_token

Write-Output "Token de autenticación: $token"

                  New to ADSelfService Plus?