curl command in AEM 6.1 | Community
Skip to main content
Level 2
October 16, 2015
Solved

curl command in AEM 6.1

  • October 16, 2015
  • 5 replies
  • 3745 views

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by kautuk_sahni

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

5 replies

kautuk_sahni
Community Manager
kautuk_sahniCommunity ManagerAccepted solution
Community Manager
October 16, 2015

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

Kautuk Sahni
Level 2
October 16, 2015

Hi Sahni,

 

many thanks for that.

Level 2
January 5, 2017

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 !!

January 6, 2017

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

MaxBarrass
Level 3
January 30, 2017

ive added these as examples here: https://github.com/paulrohrbeck/aem-links