Newer Version Available
Users Files, General
Upload a file, including references to external files,
to the Files home 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 upload a file to the Files home, it is private and available only to the file owner.
To upload a file, 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/connect/files/users/userId1/connect/communities/communityId/files/users/userId - Available since version
- 36.0
- In versions 24.0–35.0, use /chatter/users/userId/files and /connect/communities/communityId/chatter/users/userId/files, which require Chatter.
- Requires Chatter
- No
- HTTP methods
- GET, POST, or HEAD
- Request body for POST
-
- 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 example for creating a file
-
1{ 2 "desc":"Employee Survey Results", 3 "title":"emp_surv_results" 4} - JSON example for creating a reference to an external file
-
1{ 2 "repositoryId":"0XCB00000004CHJ", 3 "repositoryFileId":"document:1AnPHWYq_j56yryuRbxiVp93rD2qGqNWx7yZHvidxDpQ" 4} - Properties
-
- Request parameters for POST
-
- 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 file and uploads it to Salesforce. 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/v50.0/connect/files/users/me 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--