19 lines
687 B
Bash
19 lines
687 B
Bash
TOKEN=$(curl -s -X POST http://localhost:8080/api/auth/login \
|
|
-H "Content-Type: application/json" \
|
|
-d '{"username":"test","password":"cGFzc3dvcmQ="}' | sed -n 's/.*"token":"\([^"]*\)".*/\1/p')
|
|
|
|
#curl -H "Authorization: Bearer $TOKEN" -X POST http://localhost:8080/api/workers/test
|
|
#curl -H "Authorization: Bearer $TOKEN" -XGET http://localhost:8080/api/workers
|
|
curl -X POST http://localhost:8080/api/workers \
|
|
-H "Authorization: Bearer $TOKEN" \
|
|
-H "Content-Type: application/json" \
|
|
-d '{
|
|
"name": "Carlos",
|
|
"surname": "Fernandez",
|
|
"dni": "12345678A",
|
|
"dateOfBirth": "1990-05-15",
|
|
"email": "carlos.fernandez@example.com"}'
|
|
|
|
|
|
#echo "$TOKEN"
|