RE: add user using curl api

Amos Fong, modified 6 Years ago. New Member Posts: 23 Join Date: 3/8/19 Recent Posts
Hello, i need to create 500 new users in my portal. I am trying api json and i can not create user. Liferay says an error:
I use this curl:curl http://localhost:8080/api/jsonws/user/add-user -u test@liferay.com:12345  -d companyId=20101  -d autoPassword=false  -d password1='12345'  -d password2='12345'  -d autoScreenName=true  -d screenName=  -d emailAddress='acvalle@gmail.com'  -d facebookId=0  -d openId=''  -d locale=  -d firstName='Antonio'  -d middleName='Manuel'  -d lastName='Caballero'  -d prefixId=0 -d suffixId=0  -d male=true  -d birthdayMonth=1  -d birthdayDay=1  -d birthdayYear=1970  -d jobTitle='currante'  -d groupIds= -d organizationIds=  -d roleIds= -d userGroupIds=  -d addresses=  -d emailAddresses=  -d phones=  -d websites=  -d announcementsDelivers=  -d sendEmail=false

And liferay says:ERROR [http-nio-8080-exec-6][JSONWebServiceServiceAction:114] Email name address  must validate with com.liferay.portal.kernel.security.auth.DefaultEmailAddressValidator


Help me please. Thakns
thumbnail
Péter Petrekanics, modified 5 Years ago. New Member Post: 1 Join Date: 8/4/14 Recent Posts
Dear Antonio,

Just now I ran into this problem, and I managed to solve it by removing the single quotes from the emailAddress variable, like this:
emailAddress=acvalle@gmail.com
(instead of:   
emailAddress='acvalle@gmail.com')
After that, I tested your full curl command on a vanilla Liferay DXP 7.2 FP4 (on 17 Apr 2020), and the user was created successfully.

Best Regards,
Peter