Build link share document with API

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

Build link share document with API

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
sanjaybandhniya
Intermediate

Re: Build link share document with API

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

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

minox
Member II

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