API : Create link from a node to another node

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

API : Create link from a node to another node

I would like doing with API the same thing as my screenshot:
Capture.PNG
I think i have to use POST from : alfresco/api/-default-/public/alfresco/versions/1/nodes/5e03b048-4b47-4a53-8d5a-ac8e65f0ccd7/children
But i don't know how to build the request

{  "name": "Test link",  "nodeType": "cm:link",
  "cm:destination" : "7ddb7fad-35ed-42bf-9fc2-ab6c4e4f3ebe"
}

I have an error :

 "error": {
        "errorKey": "Can only upload type of cm:content: {http://www.alfresco.org/model/content/1.0}link",
        "statusCode": 400,
        "briefSummary": "11180776 Can only upload type of cm:content: {http://www.alfresco.org/model/content/1.0}link",
        "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"
    }
2 Replies
angelborroy
Alfresco Employee

Re: API : Create link from a node to another node

FBossant
Member II

Re: API : Create link from a node to another node

I tried with this request :

{
  "name": "The name of this link 2",
  "nodeType": "app:filelink",
  "properties" : {
     "cm:destination" : "64e6a1b4-41b5-47b8-886a-ec50edd53372"
  }
}
And it is ok

But I am disappointed with the link. I have set up the "governance" module to archive the files. My idea is to dump the files into a repository site whose directory structure will be subject to archiving rules. And to create another site (only for archivists), with a different directory structure (more user-friendly) with links to the files on the repository site. But when the files are archived, the links still exist, and a click generates an error...