cancel
Showing results for 
Search instead for 
Did you mean: 

Build link share document with API

minox
Champ on-the-rise
Champ on-the-rise

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

http://192.168.1.3:8080/share/s/g9yKWYpgQSyqXAaLPP7nA

at the moment I build URL String mainly with the alfresco-global.properties 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("share.host");
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 2

sanjaybandhaniya
Elite Collaborator
Elite Collaborator

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

https://api-explorer.alfresco.com/api-explorer/#/shared-links/createSharedLink

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