cancel
Showing results for 
Search instead for 
Did you mean: 

Quickshare by webscript

afasis
Champ on-the-rise
Champ on-the-rise

I am using Alfresco Entreprise 5.2.3.
I created a service with org.apache.chemistry.opencmis  (client) 1.1.0 with atompub connection, which creates folders and saves documents to a repository /Sites/bdes/documentLibrary/extraitconforme/  that I can view with alfresco webpage :
http://localhost:9080/share/page/site/bdes/document-details?nodeRef=workspace://SpacesStore/7d1cbc32...

 

I also want to make a document publicly downloadable with no authentication.
Meaning after saving of the document I want to make it immediatly publicly shareble for download only.
Because there is nothing in chemistry doing this I start using Alfresco's following webscript.

/api/internal/shared/share/{store_protocol}/{store_id}/{node_id}
http://localhost:9080/alfresco/service/index/uri/api/internal/shared/share/%7Bstore_protocol%7D/%7Bs... 

 

Because this is a httppost request to the server, I cannot do this without authentication.
So I got an authtenication ticket first by the webscript : /alfresco/service/api/login

 

Than I call the "quickshare" webscript : /alfresco/service/api/internal/shared/share/workspace/SpacesStore/{node_id}.

to make the document publicly shareble and get a share_id.
Because I don't know yet how to get the nodeId (unless its the same as the docId from Document

I get de the id from sharelink in alfresco webpage in the share field and add it to the httppost

So My httppost to make the file shareable will be :

http://localhost:9080/alfresco/service/api/internal/shared/share/workspace/SpacesStore/7d1cbc32-747d...?ticket=TICKET_d3e8854a4f253a1608615b294c5ed8520fd94f1f

or

http://localhost:9080/alfresco/service/api/internal/shared/share/workspace/SpacesStore/7d1cbc32-747d...?alf_ticket=TICKET_d3e8854a4f253a1608615b294c5ed8520fd94f1f

 

when putting this in my browser (firefox) , I get :

 

status
code    500
name    "Internal Error"
description    "An error inside the HTTP server which prevented it from fulfilling the request."
message    "04290072 Wrapped Exception (with status template): 04290094 Unable to find: workspace/SpacesStore/7d1cbc32-747d-44ba-9d1a-6a0709be4b77"
exception    ""
callstack    []
server    "Enterprise v5.2.3 (r852994b1-b12) schema 10.065"
time    "29-mei-2018 18:22:04"

 

What am I doing wrong here?..
Can I even use ticket to get a document publicaly downloadable?

 

Can anyone please help me out.

I've read a lot of article about this, still I dont see whats wrong here.

10 REPLIES 10

jpotts
World-Class Innovator
World-Class Innovator

When I use curl I can create a shared link by posting to the same URL you are using. I can do it successfully without an expiration date by posting:

{ "nodeId" : "0a0e5f81-20ec-43ee-ac85-232a52abbc6b"}

And I can do it successfully with an expiration date by posting:

{ "nodeId" : "0a0e5f81-20ec-43ee-ac85-232a52abbc6b", "expiresAt": "2018-11-06T16:57:37.276+0000"}

So you are either trying to share something that is already shared, which will return an error, or you are specifying a bad/missing nodeId, or the format of the date in your expiresAt property is incorrect.