| 12345678910111213141516171819202122232425262728293031323334 |
- # Script PowerShell pour tester la requête POST_userV2.php
- # avec toutes les données récupérées depuis les endpoints
- $jsonFile = Join-Path $PSScriptRoot "post_user_request.json"
- $url = "http://localhost/api/user/user/POST_userV2.php"
- if (-not (Test-Path $jsonFile)) {
- Write-Host "❌ Erreur: Le fichier $jsonFile n'existe pas!" -ForegroundColor Red
- exit 1
- }
- Write-Host "📋 Fichier JSON: $jsonFile" -ForegroundColor Cyan
- Write-Host "🌐 URL: $url" -ForegroundColor Cyan
- Write-Host ""
- Write-Host "🚀 Envoi de la requête POST..." -ForegroundColor Yellow
- Write-Host ""
- try {
- $jsonContent = Get-Content $jsonFile -Raw
- $response = Invoke-RestMethod -Uri $url -Method Post -Body $jsonContent -ContentType "application/json" -ErrorAction Stop
-
- Write-Host "✅ Succès!" -ForegroundColor Green
- Write-Host ""
- Write-Host "📄 Réponse:" -ForegroundColor Cyan
- $response | ConvertTo-Json -Depth 10
- } catch {
- Write-Host "❌ Erreur lors de la requête:" -ForegroundColor Red
- Write-Host $_.Exception.Message -ForegroundColor Red
- if ($_.ErrorDetails) {
- Write-Host $_.ErrorDetails.Message -ForegroundColor Red
- }
- }
|