function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Nader Hadji GhanbariNader Hadji Ghanbari 

How to create a File and link it to a case via REST API?

In the Lightning UI if you attach a file to a Case it won't be created as an Attachment, rather as a File. I could not find anything about this in the REST API docs.

What I found just by try and error is that one must create a ContentBody, a ContentDocument, a ContentDocumentVersion and finally a ContentDocumentLink to link it to the Case. If this is really the way, how to upload the file in the first place? i.e. how to create a ContentBody? Again nothing related to this in the docs. 

My assumption is that still a multi-part request with a `Body` part should work but haven't tried it yet. Any help would be appreciated.