cancel
Showing results for 
Search instead for 
Did you mean: 

Trouble accessing share resources via RESTful api and ticket

chuyser
Champ in-the-making
Champ in-the-making
I would like to use the RESTful API to access a list of documents accessible by a particular user. I can log in to alfredo and get the associated ticket, and calls such as http://server_ipSmiley Tongueort/alfresco/service/api/people/username/sites?alf_ticket=TICKET_ticketnum succeed in getting the list of sites for a user. But calls against the share fail. For instance: http://server_ipSmiley Tongueort/share/service/components/documentlibrary/data/doclist/all/node/alfresco/company/...

results in an internal server error with the stack trace giving the following error message: "exception": "org.springframework.extensions.webscripts.WebScriptException - 06040013 Failed to execute script 'classpath*:alfresco/site-webscripts/org/alfresco/components/documentlibrary/data/surf-doclist.get.js': 06040012 06040013 Failed to run action evaluator: 06040012 User ID must exist and cannot be guest."

Similarly, http://server_ipSmiley Tongueort/share/service/components/documentlibrary/data/doclist/all/node/workspace/SpacesS... gives a 401 response without the ticket, and the same server error as above when the ticket is passed with the URL.

I am using Postman as my testbed. I have tried setting the Authentication header in the Basic Header portion of Postman to resolve this – and tried the URL with and without the ticket – but I have had no luck (without the ticket, I simply get a 401 Unauthorized status from the server). I have also tried the URL parameter as "ticket" instead of "alf_ticket". Just for grins, I also tried these calls via curl, with the same results.

I am running against Alfredo community edition 4.0.0, build 7, schema 5025.

Any help would be greatly appreciated!

Thanks,
Cindy Huyser
5 REPLIES 5

castgroupteam
Champ in-the-making
Champ in-the-making
Hi Cindy try to pass to your webscript a parameter called "ticket" instead of "alf_ticket".

I have actually tried "ticket" instead of "alf_ticket" to access the share, but had no luck 😞 .

Hi. You can't access to share service using alf_ticket. The alfresco RESTful API resides on the /alfresco context.
You can look at this webscript for example:
http://hostSmiley Tongueort/alfresco/service/api/node/workspace/SpacesStore/3c1586a2-87da-4611-aa55-99bb88ae4568/...
where 3c1586a2-87da-4611-aa55-99bb88ae4568 coud be the uuid of the user home folder.

Otherwise you can use open cmis library:
http://chemistry.apache.org/java/opencmis.html

or you can easily write your own webscript handling the format you want:
http://wiki.alfresco.com/wiki/Web_Scripts_Examples

chuyser
Champ in-the-making
Champ in-the-making
This is admittedly a newbie question – but how would I find the UUID for the user's home folder via the /alfredo context?

chuyser
Champ in-the-making
Champ in-the-making
I finally got the correct syntax to use /alfresco to access the user's folder with a ticket:
http://serverIPSmiley Tongueort/ alfresco/service/slingshot/doclib2/doclist /treenode/node/alfresco/company/home/User%20Homes/{username}?alf_ticket=ticketNum

I can also now read the data that is in a site to which the member belongs:
http://serverIPSmiley Tongueort/ alfresco/service/slingshot/doclib2/doclist/all/node/workspace/SpacesStore/{sitenode id}?alf_ticket=ticketNum

where ticketNum is the TICKET_**** string returned from login.

Thanks again,
Cindy Huyser