06-23-2017 09:02 AM
Hi,
I m using Alfresco Community 5.2. I want to create link a file(this file is in another site) to site by using REST API. But I can not find any document about this issue.
How can I create link to site for folder or any document?
Thanks in advance..
06-24-2017 10:58 AM
Depending on what kind of link you want to create (symlink- or hardlink-like, or even just a peer-reference) you would have to deal with either creating/managing a node or handling associations of a node. Depending on the kind of link you may either have to know the type / property / association to use, or even create your own custom content model if nothing of the existing fits your requirement.
Unfortunately you did not really specify what the kind of link should be, e.g. what its purpose is and how it should be presented to the end-user, so my comment is rather abstract and you will probably not find any documentation on such an abstract level.
06-28-2017 02:07 AM
I m clicking "copy to" on myfiles folder or any site folder. And after that, it is appear a button called "create link". By clicking this button, I can create link for this document to any place. But now, I want to make this process (create link) with rest api.
06-30-2017 06:37 AM
any help!
06-26-2017 01:48 AM
If you just want to create a filelink it should work with the "create node" rest endpoint (see alfresco-API-explorer, see Axels create link above)
Type should be an app:filelink and in the properties you need a cm:destination set to the targets nodeRef (with workspace://SpacesStore). I think adding ".lnk" or ".url" as Extension in the nodename will force share to show an appropriate icon.
But I never tried it myself....
06-26-2017 06:09 AM
How about below webscripts?
/alfresco/s/api/node/doclink/{store_type}/{store_id}/{id}
/alfresco/s/api/site/doclink/{site}/{container}/{path}
/alfresco/s/api/site/doclink/{site}/{container}
You can find more info at webscript home.
06-26-2017 07:21 AM
You should not rely on those web scripts - they are marked with the lifecycle "internal" which means they are meant to be consumed by the Alfresco products and may change (without notice) between Alfresco versions. That is the reason that there exists a new v1 ReST API to get people off using these internal APIs.
06-28-2017 02:07 AM
Ok but what about parameters ?
07-03-2017 09:41 AM
Martin and Alex are correct. You should be able to use the new V1 REST API to create a node of the given node type (app:filelink) and set the property (cm:destination). We also have a basic unit test for this specific scenario.
See also:
Regards,
Jan
07-03-2017 10:08 AM
Ok but what is Api URL ? my api url is "http://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/nodes/43ad4f37-7bff-491e-b63... "
and my parameters :
{
"name": "Test file link",
"nodeType": "app:filelink",
"properties" : {
"cm:destination" : "b3ee89c4-bf02-44dc-a0e9-9ca6fdc9b97b"
}
}
but I get error "400 bad request"
{
"error": {
"errorKey": "Failed to change (specialise) node type - from {http://www.alfresco.org/model/content/1.0}folder to {http://www.alfresco.org/model/application/1.0}filelink",
"statusCode": 400,
"briefSummary": "06030125 Failed to change (specialise) node type - from {http://www.alfresco.org/model/content/1.0}folder to {http://www.alfresco.org/model/application/1.0}filelink",
"stackTrace": "For security reasons the stack trace is no longer displayed, but the property is kept for previous versions",
"descriptionURL": "https://api-explorer.alfresco.com"
}
}
Explore our Alfresco products with the links below. Use labels to filter content by product module.