1

I'm (successfully) uploading a file to the /connect/communities/{community}/files/users/me endpoint.

I'm able to share that file with a specified user by creating a file share /connect/communities/{community}/files/{id}/file-shares and that seems to work as well.

But what I'm unable to do is put that file in a folder. I was given some example Apex code for for the module/folder attachment:

Folder_Document_Link__c docLink = new 
Folder_Document_Link__c();  
    //for now uploading to root folder (null)       
   docLink.Content_Document_Id__c = conDoc;        
   docLink.Folder__c = currentFolderID;        
   docLink.File_Name__c = doc.ContentDocument.Title;       
     insert docLink;

But I can't figure out what the REST api equivalent for that is. The documentation reference doesn't have anything that seems like a FolderDocumentLink or ContentDocumentLink.

I've tried adding parentFolderId to the initial POST to /connect/communities/{community}/files/users/me but that seems to be ignored.

The documentation implies that I can add files to a folder by POST-ing to /connect/folders/{folderId}/items but it seems to be about initial upload, not about linking an existing file to that item.

I'm sure this is trivial to someone who knows their way around this API, but I'm relatively new and totally stumped. Thanks!

1
  • Update. using the workbench.developerforce.com and the REST explorer, I was able to find the /services/data/v49.0/sobjects/Folder_Document_Link__c endpoint which appears as if it should work. Commented Sep 17, 2020 at 16:36

1 Answer 1

0

It turns out that /sobjects/Folder_Document_Link__c works after all.

I just needed a pointer to the workbench rest explorer, as it's more comprehensive than the rest /connect API documentation.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .