Build link share document with API

Showing results for 
Search instead for 
Did you mean: 
Active Member

Build link share document with API

Good morning,
regarding building URL Alfresco document something like this :

at the moment I build URL String mainly with the in this way :
NodeRef curNode = new NodeRef("workspace://SpacesStore/" + node );
QuickShareDTO qsdto = quickShareService.shareContent(curNode);
String id = qsdto.getId();

String protocol = properties.getProperty("share.protocol");
String host = properties.getProperty("");
String port = properties.getProperty("share.port");
String context = properties.getProperty("share.context");

String stringUrl = protocol + "://" + host + ":" + port + "/" + context + "/s/" + id;

I'd like to know if there is another way with API Alfresco to do the same -> String stringUrl

Many thanks

2 Replies

Re: Build link share document with API

You can use REST Api to create shared link for document.

Active Member

Re: Build link share document with API

thanks sanjaybandhniya for help
but with REST as you suggested I could build the second part of the URL

for instance : I need the complete URL -> http://localhost:8180/share/s/g9yKWYpgQSyqXAaLHP74nA

in the response of REST there is -> /share/s/g9yKWYpgQSyqXAaLHP74nA
but how can I get -> http://localhost:8180/

many thanks