# Définir l'URL de l'API
$apiUrl = "https://localhost/action/getusers"
$apiKey = "TOKEN"

# Ignorer les erreurs de certificat SSL non valide
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

# Envoyer la requête GET à l'API
$response = Invoke-RestMethod -Uri $apiUrl -Method Get -Headers @{ "x-api-key" = $apiKey }

# Afficher la réponse de l'API
$response | Format-List
