Expand my Community achievements bar.

SOLVED

how to retrieve node path from uuid ?

Avatar

Level 4

I need to retrieve a node path from uuid.

I tried query debugger (http://server:port/libs/cq/search/content/querydebug.html) as follows but it give a json and I not able to get a exact node path value

QUERY

1_property=jcr:uuid
1_property.value=2770975e-b5c6-4926-90da-7f7fc79c8393

Output JSON

{"jcr:predecessors":["c92b757f-ef96-454c-a3b7-2e66af6d55c5"],"jcr:uuid":"14493c54-d61d-41c8-9f96-083e943e731e","jcr:mixinTypes":["mix:versionable"],"jcr:createdBy":"admin","titleUpdatedTime":1449191314114,"jcr:versionHistory":"77248e24-174f-439e-89da-8f309194a85e","jcr:created":"Fri Dec 04 2015 09:21:30 GMT+1100","jcr:baseVersion":"c92b757f-ef96-454c-a3b7-2e66af6d55c5","jcr:primaryType":"cq:PageContent","jcr:isCheckedOut":true}

 

I have a multiple (> 1000) uuid's that I need to retrieve paths for. Is there a way to retrieve path for all of the in one go. This is not a development task of a code being developed. this is a maintenance task for repository cleanup.

Any pointers ?

/Regards
Kanwal

1 Accepted Solution

Avatar

Correct answer by
Level 10

Without coding - there is no way to get these paths using the uuid value. The best way to get these values is to write query logic using AEM Query APIs. 

View solution in original post

2 Replies

Avatar

Administrator

Hi 

Here is the way,

1. go to query builder tool "http://localhost:4502//libs/cq/search/content/querydebug.html"

2. Add

type=jcr:uuid
path=/home/users
nodename=zlI6uTirb-Vp5zSO07xo 
p.limit=10

3. Do searching, you will get your result. nodename is UUID

 

Note:- Use "JSON QueryBuilder Link" not the ATOM Feed QueryBuilder Link.

//Xpath Query

/jcr:root/home/users//* 
[
fn:name() = 'zlI6uTirb-Vp5zSO07xo_x0020_' 
]

Json response :- http://localhost:4502/bin/querybuilder.json?nodename=zlI6uTirb-Vp5zSO07xo%20&p.limit=10&path=%2fhome...

//Nodename in url is UUID.

 

You can also access the node by identifier programatically using this the java.jcr.Session.getNodeByIdentifier

http://www.day.com/maven/javax.jcr/javadocs/jcr-2.0/javax/jcr/Session.html#getNodeByIdentifier(java....)

If you want to be able to have access to it through a HTTP request, then create a servlet that would expose this functionality.

 

Reference article for accessing JCR nodes

Link:- https://helpx.adobe.com/experience-manager/using/jqom.html

Link:- https://helpx.adobe.com/experience-manager/using/using-query-builder-api1.html (Query Builder)

Link:- https://helpx.adobe.com/experience-manager/using/querying-experience-manager-data-using1.html (JCR API)

 

I hope this would help you.

Thanks and Regards

Kautuk Sahni



Kautuk Sahni

Avatar

Correct answer by
Level 10

Without coding - there is no way to get these paths using the uuid value. The best way to get these values is to write query logic using AEM Query APIs.