RE: API Update user name

Jamie Sammons, modified 3 Years ago. New Member Posts: 3 Join Date: 8/11/15 Recent Posts

Hello,

we need to update user in Liferay, based on changes is our system, including firstName and lastName. API has method for whole user update, but it needs all data including all organizations, all groups, etc. otherwise it removes them. We were not able to get all of these data from JSON API calls. 

Is there an easy way to call this method and have all data that needs to be passed in request? Get user method does not return all that is needed.
We are thinking about writing our own endpoint for this update, but from java its the same in terms of data that are needed. But there it could be easier to get everything we need. Is there some other method, to change just what we want, that we missed?

Thank you for any help

thumbnail
Jamie Sammons, modified 3 Years ago. Expert Posts: 308 Join Date: 2/13/13 Recent Posts

I might be misunderstanding, but you should be able to PUT the user account to update it:, and you don't need nearly as many parameters

curl -H "Content-Type: application/json" \
-X PUT 	"http://localhost:8080/o/headless-admin-user/v1.0/user-accounts/42761" \
-d "{\"alternateName\": \"baker\", \"emailAddress\": \"able@liferay.com\", \"familyName\": \"Bar\", \"givenName\": \"Baker\"}" \
-u "test@liferay.com:test"

See the User Account API docs.