Expand my Community achievements bar.

SOLVED

curl command to fetch user path in JCR by Login id ?

Avatar

Level 2

Hi, is there a curl command to fetch a User's JCR path by Login Id? The curl command to change a user's password requires his JCR path (e.g. below), so I'm thinking to fetch user's JCR path by Id, in the prior step. Please suggest other alternate approach, if any.

 

e.g. curl -u testuser:OLD_PWD -F rep:password=”NEW_PWD” http://localhost:4502/home/users/t/testuser.rw.html

 

Thanks.

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @bsr78033597 

 

You can use Query builder path query to access user path by login ID. Find the example below

 

curl -u admin:admin "http://localhost:4502/bin/querybuilder.json?path=/home/users&property=rep:authorizableId&property.value=admin"

 

The query will return data in json format like 

 

{
"success": true,
"results": 1,
"total": 1,
"more": false,
"offset": 0,
"hits": [
{
"path": "/home/users/f/fKws0F07AYaqkqiiKTQs",
"excerpt": "",
"name": "fKws0F07AYaqkqiiKTQs",
"title": "fKws0F07AYaqkqiiKTQs",
"created": "2020-03-26 13:15:40"
}
]
}

 

Hope it helps!

Thanks!

Nupur

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

Hi @bsr78033597 

 

You can use Query builder path query to access user path by login ID. Find the example below

 

curl -u admin:admin "http://localhost:4502/bin/querybuilder.json?path=/home/users&property=rep:authorizableId&property.value=admin"

 

The query will return data in json format like 

 

{
"success": true,
"results": 1,
"total": 1,
"more": false,
"offset": 0,
"hits": [
{
"path": "/home/users/f/fKws0F07AYaqkqiiKTQs",
"excerpt": "",
"name": "fKws0F07AYaqkqiiKTQs",
"title": "fKws0F07AYaqkqiiKTQs",
"created": "2020-03-26 13:15:40"
}
]
}

 

Hope it helps!

Thanks!

Nupur

Avatar

Community Advisor

User info is exposed by /libs/cq/security/userinfo.json

e.g.
{"userID":"anonymous","userName":"anonymous","userName_xss":"anonymous","home":"/home/users/a/anonymous","impersonated":false,"allowedApps":[],"preferences":{}}



Arun Patidar