cancel
Showing results for 
Search instead for 
Did you mean: 

Alfresco 5.0.c : Unable to access the content/data for a node/document using Rest API

manoj27
Champ in-the-making
Champ in-the-making
Hi,

I am trying to access the data of a node/document using following API:

http://<host>:<port>/alfresco/service/api/node/{store_type}/{store_id}/{id}

And, it is giving 404 error with following response:


404 Description:   Requested resource is not available.

Message:   08020013 Script url /api/node/workspace/SpacesStore/b4cff62a-664d-4d45-9302-98723eac1319 does not map to a Web Script.


However, this same API works properly for Alfresco Community 4.2.f and returns the data in XML format.

I have tried to hit other following Web Scripts APIs, which works fine.

http://<host>:<port>/alfresco/service/api/node/{store_type}/{store_id}/{id}/comments
http://<host>:<port>/alfresco/service/api/node/{store_type}/{store_id}/{id}/metadata



Could someone please help, regarding what and how to fix. Or, is there any API changes for Alfresco Community 5?
I have checked the alfresco wiki and forum, but couldn't find the required inputs.

Thanks.
11 REPLIES 11

mitpatoliya
Star Collaborator
Star Collaborator
You can use either one of this based on type of content you are trying to access.

http://<host>:<port>/alfresco/service/index/uri/api/node/content%7Bproperty%7D/%7Bstore_type%7D/%7Bstore_id%7D/%7Bid%7D


http://<host>:<port>/alfresco/service/index/uri/api/node/folder%7Bproperty%7D/%7Bstore_type%7D/%7Bstore_id%7D/%7Bid%7D

http://<host>:<port>/alfresco/service/index/uri/api/node/%7Bstore_protocol%7D/%7Bstore_id%7D/%7Bnode_id%7D/metadata

manoj27
Champ in-the-making
Champ in-the-making
Hi Mits,

Thanks for the response.
I have tried the suggested API's, but it seems like they are not working as

expected.

Only,
http://: /alfresco/service/index/uri/api/node/%7Bstore_protocol%7D/%7Bstore_id%7D/%7Bnode_id%7D/metadata


is working fine, but other two are giving following error.

Here are the details of error.

<b>API</b> :

/alfresco/service/index/uri/api/node/folder%7Bproperty%7D/%7Bstore_type%7D/%7Bstore_id%7D/%7Bid%7D
I am using the property names using api
/alfresco/service/api/properties
for e.g. cm:content
<b>Error</b> :
<div>
         <table>
            <tr>
                <td><span class="title">Web Script Status 405 - Method Not Allowed</span></td>
            </tr>
         </table>
         <br/>
         <table>
            <tr><td>The Web Script <a href="%2Falfresco%2Fservice%2Fapi%2Fnode%2Ffolder%2Fworkspace%2FSpacesStore%2Fe6371caa-9c95-4b11-957f-294c1b716de7">/alfresco/service/api/node/folder/workspace/SpacesStore/e6371caa-9c95-4b11-957f-294c1b716de7</a> has responded with a status of 405 - Method Not Allowed.</td></tr>
         </table>
         <br/>
         <table>
            <tr><td><b>405 Description:</b></td><td> The method specified in the Request-Line is not allowed for the resource identified by the Request-URI.</td></tr>
            <tr><td> </td></tr>
            <tr><td><b>Message:</b></td><td>08070087 Script url /api/node/folder/workspace/SpacesStore/e6371caa-9c95-4b11-957f-294c1b716de7 does not support the method GET</td></tr>
            <tr><td></td><td> </td></tr>
   <tr><td><b>Exception:</b></td><td>org.springframework.extensions.webscripts.WebScriptException - 08070087 Script url /api/node/folder/workspace/SpacesStore/e6371caa-9c95-4b11-957f-294c1b716de7 does not support the method GET</td></tr>
   <tr><td></td><td> </td></tr>
         <tr><td></td><td>org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:179)</td></tr>
         <tr><td></td><td>org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:132)</td></tr>
         <tr><td></td><td>javax.servlet.http.HttpServlet.service(HttpServlet.java:727)</td></tr>
         <tr><td></td><td>org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)</td></tr>
         <tr><td></td><td>org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)</td></tr>
         <tr><td></td><td>org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)</td></tr>
         <tr><td></td><td>org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)</td></tr>
         <tr><td></td><td>org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)</td></tr>
         <tr><td></td><td>org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:61)</td></tr>
         <tr><td></td><td>org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)</td></tr>
         <tr><td></td><td>org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)</td></tr>
         <tr><td></td><td>org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)</td></tr>
         <tr><td></td><td>org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)</td></tr>
         <tr><td></td><td>org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)</td></tr>
         <tr><td></td><td>org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)</td></tr>
         <tr><td></td><td>org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)</td></tr>
         <tr><td></td><td>org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)</td></tr>
         <tr><td></td><td>org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)</td></tr>
         <tr><td></td><td>org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)</td></tr>
         <tr><td></td><td>org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)</td></tr>
         <tr><td></td><td>org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)</td></tr>
         <tr><td></td><td>org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2441)</td></tr>
         <tr><td></td><td>org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2430)</td></tr>
         <tr><td></td><td>java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)</td></tr>
         <tr><td></td><td>java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)</td></tr>
         <tr><td></td><td>java.lang.Thread.run(Unknown Source)</td></tr>
         </table>
      </div>


<b>API</b> : /alfresco/service/api/node/content/workspace/SpacesStore/{node_id}
<b>Error</b> :
<div>
         <table>
            <tr>
               <td><img src="/alfresco/images/logo/AlfrescoLogo32.png" alt="Alfresco" /></td>
               <td><span class="title">Web Script Status 404 - Not Found</span></td>
            </tr>
         </table>
         <br/>
         <table>
            <tr><td>The Web Script <a href="%2Falfresco%2Fservice%2Fapi%2Fnode%2Fcontent%2Fworkspace%2FSpacesStore%2Fe6371caa-9c95-4b11-957f-294c1b716de7">/alfresco/service/api/node/content/workspace/SpacesStore/e6371caa-9c95-4b11-957f-294c1b716de7</a> has responded with a status of 404 - Not Found.</td></tr>
         </table>
         <br/>
         <table>
            <tr><td><b>404 Description:</b></td><td> Requested resource is not available.</td></tr>
            <tr><td> </td></tr>
            <tr><td><b>Message:</b></td><td>08070089 Unable to locate content for node ref workspace://SpacesStore/e6371caa-9c95-4b11-957f-294c1b716de7 (property: {http://www.alfresco.org/model/content/1.0}content)</td></tr>
            <tr><td></td><td> </td></tr>
   <tr><td><b>Exception:</b></td><td>org.springframework.extensions.webscripts.WebScriptException - 08070089 Unable to locate content for node ref workspace://SpacesStore/e6371caa-9c95-4b11-957f-294c1b716de7 (property: {http://www.alfresco.org/model/content/1.0}content)</td></tr>
   <tr><td></td><td> </td></tr>
         <tr><td></td><td>org.alfresco.repo.web.scripts.content.ContentStreamer.streamContent(ContentStreamer.java:238)</td></tr>
         <tr><td></td><td>org.alfresco.repo.web.scripts.content.StreamContent.streamContent(StreamContent.java:264)</td></tr>
         <tr><td></td><td>org.alfresco.repo.web.scripts.content.ContentGet.streamContentLocal(ContentGet.java:167)</td></tr>
         <tr><td></td><td>org.alfresco.repo.web.scripts.content.ContentGet.execute(ContentGet.java:139)</td></tr>
         <tr><td></td><td>org.alfresco.repo.web.scripts.RepositoryContainer$3.execute(RepositoryContainer.java:463)</td></tr>
         <tr><td></td><td>org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:454)</td></tr>
         <tr><td></td><td>org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:532)</td></tr>
         <tr><td></td><td>org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:600)</td></tr>
         <tr><td></td><td>org.alfresco.repo.web.scripts.RepositoryContainer.executeScriptInternal(RepositoryContainer.java:380)</td></tr>
         <tr><td></td><td>org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:261)</td></tr>
         <tr><td></td><td>org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:378)</td></tr>
         <tr><td></td><td>org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:209)</td></tr>
         <tr><td></td><td>org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:132)</td></tr>
         <tr><td></td><td>javax.servlet.http.HttpServlet.service(HttpServlet.java:727)</td></tr>
         <tr><td></td><td>org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)</td></tr>
         <tr><td></td><td>org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)</td></tr>
         <tr><td></td><td>org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)</td></tr>
         <tr><td></td><td>org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)</td></tr>
         <tr><td></td><td>org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)</td></tr>
         <tr><td></td><td>org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:61)</td></tr>
         <tr><td></td><td>org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)</td></tr>
         <tr><td></td><td>org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)</td></tr>
         <tr><td></td><td>org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)</td></tr>
         <tr><td></td><td>org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)</td></tr>
         <tr><td></td><td>org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)</td></tr>
         <tr><td></td><td>org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)</td></tr>
         <tr><td></td><td>org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)</td></tr>
         <tr><td></td><td>org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)</td></tr>
         <tr><td></td><td>org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)</td></tr>
         <tr><td></td><td>org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)</td></tr>
         <tr><td></td><td>org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)</td></tr>
         <tr><td></td><td>org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)</td></tr>
         <tr><td></td><td>org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2441)</td></tr>
         <tr><td></td><td>org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2430)</td></tr>
         <tr><td></td><td>java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)</td></tr>
         <tr><td></td><td>java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)</td></tr>
         <tr><td></td><td>java.lang.Thread.run(Unknown Source)</td></tr>
   </table>
      </div>


However, the api

/alfresco/service/api/metadata?nodeRef=workspace://SpacesStore/{node_id}
is working fine.

But, the result with above API's is not exactly what I expected. Can we get following URL working on Alfresco 5 through any configuration on server side.
/alfresco/service/api/node/{store_type}/{store_id}/{id}


Thanks,
Manoj

ryosaeba
Champ in-the-making
Champ in-the-making
Hi,

You can try with this API :
http://<host>:<port>/alfresco/service/slingshot/doclib/node/{store_type}/{store_id}/{id}
for informations about a node or this one
http://<host>:<port>/alfresco/service/api/node/content/{store_type}/{store_id}/{id}
for get content of a file

manoj27
Champ in-the-making
Champ in-the-making
Hi,

Thanks for the response.

The API
http://<host>:<port>/alfresco/service/slingshot/doclib/node/{store_type}/{store_id}/{id}
works like a charm.
I have also figured out
http://<host>:<port>/alfresco/service/slingshot/doclib2/node/{store_type}/{store_id}/{id}
which also provide more detailed information.

But, still I am not able to fetch the childrens of a node, as I couldn't get any such API in the list returned by
/alfresco/service/index/uri/
.

Also, do you have any inputs regarding why the API
/api/node/{store_type}/{store_id}/{id}
is removed or modified in Alfresco 5.
And, if that so, is the slingshot API is the one provided in place of it.

Thanks,
Manoj

ryosaeba
Champ in-the-making
Champ in-the-making
Hi,

To get children of a node, i use this API :
http://<host>:<port>/alfresco/service/slingshot/doclib/doclist/{type}/site/{site}/{container}/{path}

For {type} i use doclist. It's works fine

<blockquote>Also, do you have any inputs regarding why the API /api/node/{store_type}/{store_id}/{id} is removed or modified in Alfresco 5.
And, if that so, is the slingshot API is the one provided in place of it.</blockquote>
I have no idea, i work with alfresco only since the version 5

manoj27
Champ in-the-making
Champ in-the-making
Hi,

Thanks for your response.
I have checked the API's mentioned on
/alfresco/service/index/uri/
, but not sure about what should be values for {xyz} placeholders.
I am new to Alfresco. Could you please assist or point me to links where I can get the required values for place holders.

-Manoj

ryosaeba
Champ in-the-making
Champ in-the-making
Replace {type} by "doclist"
Replace {site} by the name of your site. You can see it on the url of the dashboard of the site (for example http://ipSmiley Tongueort/share/page/site/MY_SITE/dashboard)
Replace {container} by "documentlibrary"
Replace {path} by the the location of your folder (for example : category_name/folder_name or just category_name)

You need to replace space on the url by %20 and special chars like : http://www.w3schools.com/tags/ref_urlencode.asp

So the final url is like that : http://hostSmiley Tongueort/alfresco/service/slingshot/doclib/doclist/doclist/site/SITE_NAME/documentlibrary/CATE...

manoj27
Champ in-the-making
Champ in-the-making
Hi,

That worked like a charm! Thanks a lot.
Just to add, the doclib2 URI provides more detailed information.

I have one more query. Is there any API supported by Alfresco 5, which will provide list of NodeId's (or their path or any information) which are modified after some specified time. Alfresco 4.x had CMIS support for this purpose, but its now removed in Alfresco 5.

I assume there will surely be a alternative for this.
Could you please provide any inputs.

-Manoj

ryosaeba
Champ in-the-making
Champ in-the-making
Hi, I'm glad that it works.

Sorry for your last request, i have no idea about that. Good luck for the next.

Sebastien