Expand my Community achievements bar.

Using curl for creating user vs Manual creation

Avatar

Level 2

Hi All,

I'm trying to automate creating users in AEM and using curl command to create users. Below is the command which I'm using for creating user "test1"

curl -u admin:admin -FcreateUser= -FauthorizableId=test1 -Frep:password=test1 -Fprofile/givenName=test1 -Fprofile/familyName=test1 -Fprofile/email=test1@metlife.com -FintermediatePath=/home/users/company http://localhost:4502/libs/granite/security/post/authorizables

I'm able to create user but I'm seeing extra node "profiles" for this "test1" user in crx/de. I have compared this node structure with another user (test2) created manually from useradmin page and "test2" user doesn't have this node.

Could you let me know why there is a difference in node structure using curl command? Is this will cause any issue for users if we use curl to create users?

users_nodes.JPG

Thanks.

7 Replies

Avatar

Community Advisor

Can you try this command in your local

curl -u admin:admin -FcreateUser= -FauthorizableId=hashim -Frep:password=hashim http://localhost:4502/libs/granite/security/post/authorizables

Avatar

Employee

antonym8430968 You can create user with following curl commands:

Create New User:

curl -u admin:admin -FcreateUser= -FauthorizableId=test -Frep:password=test http://localhost:4502/libs/granite/security/post/authorizables

Create new user and assign to specific group:

curl -u admin:admin -FcreateUser=testusr -FauthorizableId=testusr -Frep:password=test1234 -Fmembership=testgroup http://localhost:4502/libs/granite/security/post/authorizables

Avatar

Level 2

Using above curl commands will not update user profile details like Firstname,lastname, email and Path.

The command which I'm using is working. My question is more on why "profiles/public" extra node(refer screenshot) is getting created when we create user using curl command.

By the way, I'm doing this in AEM 6.5

Thanks.

Avatar

Level 2

Any information on my post will be helpful?

Thanks.

Avatar

Employee Advisor

Hi,

AFAIU, The extra node seems to be getting created as you are forcing the profile node in your curl command itself that should not be done in the request. You just need to pass the values of properties like givenname, lastname, email etc in the command and internally a profile node is created to store them but since you are forcing the path as well. One of them is getting created due to your command and the other is due the internal implementation.

Avatar

Level 2

Could you please provide curl syntax  for setting up givenname,lastname,email etc instead of using -Fprofile ?

Avatar

Employee

Can you share details about what AEM version you are on ?

I tested creating a user via Tools>Security>User and cURL and both results in the profile and profiles node creation

Tested on 6.5 GA and 6.6 L7 (Adobe internal testing version)