How to get files list of a shared folder using rest api?

cancel
Showing results for 
Search instead for 
Did you mean: 
dmitriyp
Member II

How to get files list of a shared folder using rest api?

Jump to solution

Hi!

I have Alfresco Community 5.2.0

I need to get a filelist from some shared folder.

It is need for external application on android which I am developing.

The Application should get a filelist of folder, parse it and get files with names and descriptions, then user can download one or several of them.

I would like to use rest api.

I found out how authorize and get ticket by get-request.

https://my-site.com/alfresco/service/api/login?u=my_user_name&pw=my_password

Then I need to get a filelist from shared folder (it's name is test).

get-request work fine if i logged in via browser.


https://my-site.com/share/service/components/documentlibrary/data/doclist/all/node/alfresco/company/shared/test

And i get the content of this folder (filesm descriptions and etc)

But if I logged out from alfresco and try get-request with alf_ticket, it doesn't work. ticket is valid

https://my-site.com/share/service/components/documentlibrary/data/doclist/all/node/alfresco/company/shared/test?alf_ticket=TICKET_33e6923d0a527f34a2c5a276f915fcde8feafe77

I receives an error

{
"status": {
"code": 500,
"name": "Internal Error",
"description": "An error inside the HTTP server which prevented it from fulfilling the request."
},
"message": "09310019 Failed to execute script 'classpath*:alfresco/site-webscripts/org/alfresco/components/documentlibrary/data/surf-doclist.get.js': 09310018 09310019 Failed to run action evaluator: 09310018 User ID must exist and cannot be guest.",
"exception": "",
"callstack": [],
"server": "Spring WebScripts - v6.5.0 schema 1,000",
"time": "Oct 31, 2017 4:42:10 PM"
}

if ticket is invalid, it's ok, I receive status 401 Unauthorized

1 Solution

Accepted Solutions
dmitriyp
Member II

Re: How to get files list of a shared folder using rest api?

Jump to solution

Solved!

To get folder content use 

ipSmiley Tongueort/alfresco/service/slingshot/doclib2/doclist/all/node/workspace/SpacesStore/ + {folder id} + ?alf_ticket=TICKET_nnn

View solution in original post

2 Replies
dmitriyp
Member II

Re: How to get files list of a shared folder using rest api?

Jump to solution

Solved!

To get folder content use 

ipSmiley Tongueort/alfresco/service/slingshot/doclib2/doclist/all/node/workspace/SpacesStore/ + {folder id} + ?alf_ticket=TICKET_nnn

Kiwi
Member II

Re: How to get files list of a shared folder using rest api?

Jump to solution

Thank you abhinav for your reply.

I registered the 2 files desc.xml and the html.ftl files and refreshed the Wev Scripts Extensions (.js not yet involved)

http://127.0.0.1:8080/alfresco/service/abhinav/getFolderInfo?siteShortName=test&skipCount=0&maxCount...

What will be the SiteShortName in my setup (here you used 'test')
site ? in Alfresco terminilogy ?

Thanks