curl --request POST \
--url https://api.example.com/api/usuarios \
--header 'Content-Type: application/json' \
--data '
{
"username": "<string>",
"nombre": "<string>",
"apellidos": "<string>",
"email": "<string>",
"password": "<string>",
"fecha_nacimiento": "<string>",
"direccion_envio": "<string>",
"rol": "<string>",
"activo": true
}
'{
"201": {},
"400": {},
"401": {},
"403": {},
"usuario_id": 123,
"username": "<string>",
"nombre": "<string>",
"apellidos": "<string>",
"email": "<string>",
"fecha_nacimiento": "<string>",
"direccion_envio": "<string>",
"rol": "<string>",
"activo": true
}Create a new user account
curl --request POST \
--url https://api.example.com/api/usuarios \
--header 'Content-Type: application/json' \
--data '
{
"username": "<string>",
"nombre": "<string>",
"apellidos": "<string>",
"email": "<string>",
"password": "<string>",
"fecha_nacimiento": "<string>",
"direccion_envio": "<string>",
"rol": "<string>",
"activo": true
}
'{
"201": {},
"400": {},
"401": {},
"403": {},
"usuario_id": 123,
"username": "<string>",
"nombre": "<string>",
"apellidos": "<string>",
"email": "<string>",
"fecha_nacimiento": "<string>",
"direccion_envio": "<string>",
"rol": "<string>",
"activo": true
}/api/auth/registro endpoint.
ADMIN or CLIENTEcurl -X POST "http://localhost:8080/api/usuarios" \
-H "Authorization: Bearer YOUR_ADMIN_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"username": "juan_perez",
"nombre": "Juan",
"apellidos": "Pérez García",
"email": "[email protected]",
"password": "SecurePassword123!",
"fecha_nacimiento": "1990-05-15",
"direccion_envio": "Calle Mayor 123, Madrid, 28013",
"rol": "CLIENTE",
"activo": true
}'
const response = await fetch('http://localhost:8080/api/usuarios', {
method: 'POST',
headers: {
'Authorization': `Bearer ${adminToken}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
username: 'juan_perez',
nombre: 'Juan',
apellidos: 'Pérez García',
email: '[email protected]',
password: 'SecurePassword123!',
fecha_nacimiento: '1990-05-15',
direccion_envio: 'Calle Mayor 123, Madrid, 28013',
rol: 'CLIENTE',
activo: true
})
});
const user = await response.json();
import requests
headers = {
'Authorization': f'Bearer {admin_token}',
'Content-Type': 'application/json'
}
data = {
'username': 'juan_perez',
'nombre': 'Juan',
'apellidos': 'Pérez García',
'email': '[email protected]',
'password': 'SecurePassword123!',
'fecha_nacimiento': '1990-05-15',
'direccion_envio': 'Calle Mayor 123, Madrid, 28013',
'rol': 'CLIENTE',
'activo': True
}
response = requests.post(
'http://localhost:8080/api/usuarios',
headers=headers,
json=data
)
user = response.json()
{
"usuario_id": 10,
"username": "juan_perez",
"nombre": "Juan",
"apellidos": "Pérez García",
"email": "[email protected]",
"fecha_nacimiento": "1990-05-15",
"direccion_envio": "Calle Mayor 123, Madrid, 28013",
"rol": "CLIENTE",
"activo": true
}
/api/auth/registro which automatically assigns the CLIENTE role and returns a JWT token.activo: false to create inactive accounts that users cannot use to log in until an administrator activates them.