27 lines
998 B
PowerShell
27 lines
998 B
PowerShell
# Définir l'URL de l'API avec le paramètre 'group'
|
|
$groupName = "admin" # Remplacez par le nom du groupe que vous souhaitez interroger
|
|
$apiUrl = "https://localhost/action/getuseringroup?group=$groupName"
|
|
|
|
# Définir la clé API si nécessaire
|
|
$apiKey = "TOKEN" # Remplacez par votre clé API
|
|
|
|
# Ignorer les erreurs de certificat SSL non valide
|
|
Add-Type @"
|
|
using System.Net;
|
|
using System.Security.Cryptography.X509Certificates;
|
|
public class TrustAllCertsPolicy {
|
|
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 avec la clé API dans les headers
|
|
$response = Invoke-RestMethod -Uri $apiUrl -Method Get -Headers @{ "x-api-key" = $apiKey }
|
|
|
|
# Afficher la réponse de l'API
|
|
$response | Format-List
|