Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

curl command in AEM 6.1

Avatar

Level 2

Hi,

within CQ5.5 we used scripts to create user's and groups.

We're currently doing the AEM 6.1 migration and i need to adopt the scripts. As far as i can see the Requests i've recently used did not work in AEM 6.1.

In CQ5.5 we used: POST Request on http://<server>:4502/libs/granite/security/post/authorizables can anyone tell me the corresponding request for AEM 6.1?

 

Many thanks in advance

Alex

1 Accepted Solution

Avatar

Correct answer by
Administrator

Hi 

Please find below the curl commands for User Management :-

User Management Commands:

  • Create a new User
     

1

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

  • Create a new Group
     

1

curl -u admin:admin -FcreateGroup=group1 -FauthorizableId=testGroup1 http://localhost:4502/libs/granite/security/post/authorizables

  • Add a Property to an existing User
     

1

curl -u admin:admin -Fprofile/age=25 http://localhost:4502/home/users/h/hashim.rw.html

  • Create a User with a profile
     

1

curl -u admin:admin -FcreateUser=testuser -FauthorizableId=hashimkhan -Frep:password=hashimkhan -Fprofile/gender=male http://localhost:4502/libs/granite/security/post/authorizables

  • Create a new User as a member of a Group
     

1

curl -u admin:admin -FcreateUser=testuser -FauthorizableId=testuser -Frep:password=abc123 -Fmembership=contributor http://localhost:4502/libs/granite/security/post/authorizables

  • Add User to a Group
     

1

curl -u admin:admin -FaddMembers=testuser1 http://localhost:4502/home/groups/t/testGroup.rw.html

  • Remove a User from a Group
     

1

curl -u admin:admin -FremoveMembers=testuser1 http://localhost:4502/home/groups/t/testGroup.rw.html

  • Set a User’s Group Memberships
     

1

curl -u admin:admin -Fmembership=contributor -Fmembership=testgroup http://localhost:4502/home/users/t/testuser.rw.html

  • Delete user and Group
     

1

curl -u admin:admin -FdeleteAuthorizable= http://localhost:4502/home/users/t/testuser
curl -u admin:admin -FdeleteAuthorizable= http://localhost:4502/home/groups/t/testGroup

 

I hope this would help you.

 

Thanks and Regards

Kautuk Sahni

View solution in original post

0 Replies

Avatar

Correct answer by
Administrator

Hi 

Please find below the curl commands for User Management :-

User Management Commands:

  • Create a new User
     

1

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

  • Create a new Group
     

1

curl -u admin:admin -FcreateGroup=group1 -FauthorizableId=testGroup1 http://localhost:4502/libs/granite/security/post/authorizables

  • Add a Property to an existing User
     

1

curl -u admin:admin -Fprofile/age=25 http://localhost:4502/home/users/h/hashim.rw.html

  • Create a User with a profile
     

1

curl -u admin:admin -FcreateUser=testuser -FauthorizableId=hashimkhan -Frep:password=hashimkhan -Fprofile/gender=male http://localhost:4502/libs/granite/security/post/authorizables

  • Create a new User as a member of a Group
     

1

curl -u admin:admin -FcreateUser=testuser -FauthorizableId=testuser -Frep:password=abc123 -Fmembership=contributor http://localhost:4502/libs/granite/security/post/authorizables

  • Add User to a Group
     

1

curl -u admin:admin -FaddMembers=testuser1 http://localhost:4502/home/groups/t/testGroup.rw.html

  • Remove a User from a Group
     

1

curl -u admin:admin -FremoveMembers=testuser1 http://localhost:4502/home/groups/t/testGroup.rw.html

  • Set a User’s Group Memberships
     

1

curl -u admin:admin -Fmembership=contributor -Fmembership=testgroup http://localhost:4502/home/users/t/testuser.rw.html

  • Delete user and Group
     

1

curl -u admin:admin -FdeleteAuthorizable= http://localhost:4502/home/users/t/testuser
curl -u admin:admin -FdeleteAuthorizable= http://localhost:4502/home/groups/t/testGroup

 

I hope this would help you.

 

Thanks and Regards

Kautuk Sahni

Avatar

Level 2

Hi Kautuk and Guys,

when adding multiple users to a group became difficult with the way AEM 6.2 stores user and group nodes in Repository. Is there any easy way to add multiple users to a group ? or vice versa ? I was trying something like below and it works but does not helps for large set of user/groups. 

curl -u admin:admin -FaddMembers=abc.testing http://localhost:4502/home/groups/e/e3y2nsMSdULATLrZwrp_.rw.html

Help is really appreciated !!

Avatar

Employee

I'd suggest asking a new question here in the community to get your question answered, instead of adding onto this older thread.

As a suggestion toward your issue, you might try something like:
curl -u admin:admin -FaddMembers=abc.testing -FaddMembers=123.testing http://localhost:4502/home/groups/e/e3y2nsMSdULATLrZwrp_.rw.html

 

Kind regards,

- Carey