6 lines
554 B
PowerShell
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
|