Newer Version Available
Users Files, General
Post a file, including references to external files, to
Salesforce Files Sync or get
information about files a user owns. These files don’t include files shared with a
user, files a user follows, or general organization files.
When you post a file, it is uploaded to the Files tab as a private file and is available only to the file owner.
To upload a file, you must send it in a multipart/form-data request. You can include the description and title of the file in the multipart/form-data request as a JSON or XML request body. You can also send the information as request parameters. For information about how to create the multipart/form-data message, see Uploading Binary Files.
- Resource
-
1/chatter/users/userId/files/1/connect/communities/communityId/chatter/users/userId/files/ - Available since version
- 24.0
- Requires Chatter
- Yes
- HTTP methods
- GET, POST, or HEAD
- Request body for POST
-
- Describes a new file input. To upload a file, provide the binary file in a multipart/form-data body part where name="fileData". See Uploading Binary Files.
- Root XML tag
- <fileInput>
- JSON
-
1{ 2 "desc":"Employee Survey Results", 3 "title":"emp_surv_results" 4} - Properties
-
- Request parameters for POST
-
Name Type Description Required or Optional Available version contentModifiedDate Date File-specific last modified date that can be used to set a client-side modified date. Optional 32.0 desc String Description of the file Optional 24.0 isDataSync Boolean The request is automatically generated by an automated client Optional 31.0 isInMyFileSync Boolean true if the file is synced withSalesforce Files Sync; false otherwise. The default value is false. Optional 31.0 isMajorVersion Boolean true if the file is a major version; false if the file is a minor version. Major versions can’t be replaced. The default value is false. Optional 31.0 repositoryFileId String ID of the external file. Optional 32.0 repositoryId String ID of the external data source. Optional 32.0 title String Title of the file Optional 24.0 - Request parameters for GET
-
Parameter Name Type Description Available Since page Integer An integer specifying a page of items. The default value is 0, which returns the first page. 24.0 pageSize Integer Specifies the number of items per page. Valid values are from 1 through 100. If you don't specify a size, the default is 25. 24.0 q String A query string to filter the results. The string must contain at least two characters, not including wildcards. For information about wildcards, see Wildcards. 27.0 - Response body for GET
- File Summary Page
- Response body for POST
- File Summary
- Example POST request
- This example creates a new file and uploads it to Salesforce Files Sync. The example shows the body parts in a multipart/form-data request.
The first body part is a File Input request body. The second is the
content of the file. For more information, see Uploading Binary Files.
1POST /services/data/v34.0/chatter/users/me/files 2 3Authorization: OAuth 00DD0000000Jhd2!AQIAQC.lh4qTQcBhOPm4TZom5IaOOZLVPVK4wI_rPYJvmE8r2VW8XA. 4OZ7S29JEM_7Ctq1lst2dzoV.owisJc0KacUbDxyae 5User-Agent: Jakarta Commons-HttpClient/3.0.1 6Host: instance_name 7Content-Length: 489 8Content-Type: multipart/form-data; boundary=a7V4kRcFA8E79pivMuV2tukQ85cmNKeoEgJgq 9Accept: application/json 10 11--a7V4kRcFA8E79pivMuV2tukQ85cmNKeoEgJgq 12Content-Type: application/json; charset=UTF-8 13Content-Disposition: form-data; name="json" 14 15{ 16 "title":"BoatPrices" 17} 18 19--a7V4kRcFA8E79pivMuV2tukQ85cmNKeoEgJgq 20Content-Disposition: form-data; name="fileData"; filename="BoatPrices.txt" 21Content-Type: application/octet-stream; charset=ISO-8859-1 22 23...contents of BoatPrices.txt... 24 25--a7V4kRcFA8E79pivMuV2tukQ85cmNKeoEgJgq--