cancel
Showing results for 
Search instead for 
Did you mean: 

Alfresco CMIS Web Scripts API for 'getContent' by path is not working

mathias_lin
Star Contributor
Star Contributor
I had read
http://forums.alfresco.com/forum/developer-discussions/alfresco-api/cmis-getcontent-example-09262012...
but did not find an OpenCMIS services URI / sample of how to fetch node content by providing it's path only, not it's UUID.

<strong>The problem:</strong>

I have a file in my Alfresco (4.1.5) repository of which I want to read the content through the Alfresco services REST API. For the lookup, I want to use the file path, not the UUID. However, the lookup by path does not work, only the lookup by UUID works. I cannot find the mistake.

This is the file path:

<strong>DisplayPath & File Name:</strong>

/Company Home/Data Dictionary/Cleaner Configs/cleaner.properties


<strong>QNamePath:</strong>

/app:company_home/app:dictionary/cm:Cleaner_x0020_Configs/cm:cleaner.properties


Lookup by UUID works with the following REST API url:

http://localhost:8080/alfresco/service/cmis/i/2391adf9-365c-4959-bf30-8f001154c100/content


However, lookup by path only does not work. Neither with the primary path nor the display path:

http://localhost:8080/alfresco/service/cmis/p/app:company_home/app:dictionary/cm:Cleaner_x0020_Confi...


http://localhost:8080/alfresco/service/cmis/p/Company%20Home/Data%20Dictionary/Cleaner%20Configs/cle...


I am getting a 404 error in both cases:

<blockquote>
Message:    10080001 Unable to find ObjectPathReference[storeRef=workspace://SpacesStore,path=/app:company_home/app:company_home/app:dictionary/cm:Cleaner_x0020_Configs/cm:cleaner.properties]

Exception:  org.springframework.extensions.webscripts.WebScriptException - 10080001 Unable to find ObjectPathReference[storeRef=workspace://SpacesStore,path=/app:company_home/app:company_home/app:dictionary/cm:Cleaner_x0020_Configs/cm:cleaner.properties]
</blockquote>


<strong>Reference:</strong>

http://wiki.alfresco.com/wiki/CMIS_Web_Scripts_Reference#Get_Content_.28getContent.29

<blockquote>
Gets the content stream for the specified document, or gets a rendition stream for a specified rendition of a document.

GET /alfresco/service/cmis/p{path}/content{property}?a={attach?}
</blockquote>
4 REPLIES 4

arnoldschrijve1
Champ on-the-rise
Champ on-the-rise
Hi,

Seems like the root of your path is too high up the hierarchy. That's why you see company_home appear twice in your error message.
Try to remove the company_home part like such:

http://localhost:8081/alfresco/service/cmis/p/Data%20Dictionary/Cleaner%20Configs/cleaner.properties...

arnoldschrijve1
Champ on-the-rise
Champ on-the-rise
And use 8080 of course (I tested against my own alfresco repo on 8081 Smiley Happy

kaynezhang
World-Class Innovator
World-Class Innovator
Cmis's root / is mapped to /app:company_home,so /Data%20Dictionary is automaticlly mapped to /app:company_home/Data%20Dictionary.you should not prefix it with /app:company_home,or it'll be interpretered to /app:company_home/app:company_home/Data%20Dictionary which will be not found .
And using cmis you can only access nodes under /app:company_home.

How can I obtain a display path from the Alfresco API? (without qnames)

If I want the path of a node, I do the following:


getNodeService().getPath(nodeRef)


It returns something like this:

<blockcode>
{http://www.alfresco.org/model/application/1.0}company_home/{http://www.alfresco.org/model/applicatio...
</blockcode>

But I want a path like:

<blockcode>
/company_home/User Homes/AGP/AGP2/New Documents/Test.pdf
</blockcode>

Without the qnames, types, and with the correct format without _x0020_ codes.

Are there a method from the Alfresco API to get this type of path? Or I must decode it writing an own method in Java?

Thanks!

PD: I answer myself… Smiley Surprised)


getNodeService().getPath(nodeRef).toDisplayPath(getNodeService(), getPermissionService()