I need to load files into Salesforce via an API as part of some integration work. I want to be loading files as Salesforce Files (not attachments) so we can version files if need be and I also need to make sure that the resulting uploaded file is available to Community licensed users who have access to the record. There seem to be two API options:
- Using the Chatter API where you upload a file to Files home for a user through a request to /connect/files/users/userid (example on this page) and then relate it to a record by doing a request to /chatter/feed-elements as described here.
- Uploading as a ContentDocument via the REST API, although the example shown in API describe that in the context of Salesforce Content, which is not something we are interested in using.
Is the best option one of the above or something else altogether? Are there any limits that I should be aware of? I think that either option would be fine for files 50MB or potentially a bit more, which would be enough for us. In terms upload numbers, we're probably going to be around a few thousand at most per day.