Files
CompanyRegister/scripts/create_user_check.ps1
2026-01-28 23:56:33 +08:00

6 lines
554 B
PowerShell

$login = Invoke-RestMethod -Method Post -Uri http://localhost:8080/api/v1/auth/login -Body (@{username='admin';password='admin123'}|ConvertTo-Json) -ContentType 'application/json'
$token = $login.data.token
$payload = @{username='u1';password='u1123';fullName='Test User';email='u1@example.com';phone='123456';role='EMPLOYEE'} | ConvertTo-Json
$response = Invoke-RestMethod -Method Post -Uri http://localhost:8080/api/v1/users -Headers @{Authorization='Bearer '+$token} -Body $payload -ContentType 'application/json'
$response | ConvertTo-Json -Compress