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
camelUsercamelUser 

Salesforce Upload a file to the Files home (Share with users and opportunity?)

I have taken a look through the forum and cant find what i am after so i might have the wrong method here.

I need to upload files to Salesforce via an API and need use Salesforce Files (not attachments) so we can version files if needed. I also need to make sure that the resulting uploaded file is available to all users.
The upload of the file seems to be straight forward enough from what i have read i should be using the chatter API to upload the document to Files home (https://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/intro_input.htm) "Upload a file to the Files home" section.

The trouble is the "files home" endpoint url is user specific.

What i need to achieve via the API:

1. Upload a file to files home.
2. Share the uploaded file with an Opportunity so that is is visible on the opportunity via the files related list.
Potentially share the file with other users / all users

Points 2 and 3 i am struggling with does anyone have an example / thread they can point me to.