Newer Version Available

This content describes an older version of this product. View Latest

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.

This resource can return a large amount of data and, when it does, takes some time to process.

Important

Resource
1/connect/files/users/userId
1/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
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
Name Type Description Required or Optional Available Version
content​ModifiedDate 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 to be uploaded. Optional 24.0
includeExternal​FilePermissions​Info Boolean Specifies whether to include permission information, such as whether the file is shared and what are the available permission types, for external files.

This property can be used with POST requests to /connect/files/users/userId, but not with POST requests to /connect/files/fileId.

Optional 35.0
isInMyFileSync Boolean true if the file is synced withSalesforce Files Sync; false otherwise. 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. Optional 31.0
parentFolderId String ID of the containing folder. Optional 31.0
repository​FileId String ID of the external file.

This property can be used with POST requests to /connect/files/users/userId, but not with POST requests to /connect/files/fileId.

If you specify repositoryFileId, don’t specify repositoryFileUri.

Optional 32.0
repository​FileUri String URI of the external file, such as https://drive.google.com/file/d/​0B7a_ei8brT1TMy1CQ0o5NmZQNEE/view.

This property can be used with POST requests to /connect/files/users/userId, but not with POST requests to /connect/files/fileId.

If you specifyrepositoryFileUri, don’t specify repositoryFileId.

Optional 39.0
repositoryId String ID of the external data source.

This property can be used with POST requests to /connect/files/users/userId, but not with POST requests to /connect/files/fileId.

Required if repositoryFileId is specified. Otherwise, Optional. 32.0
reuseReference Boolean Specifies whether to reuse the latest version of a reference you own to an external file rather than creating a duplicate reference.

This property can be used with POST requests to /connect/files/users/userId, but not with POST requests to /connect/files/fileId.

Optional 36.0
sharingOption String Sharing option of the file. Values are:
  • Allowed—Resharing of the file is allowed.
  • Restricted—Resharing of the file is restricted.
Optional 35.0
title String Title of the file. Optional 24.0
Request parameters for POST
Name Type Description Required or Optional Available version
content​ModifiedDate 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
includeExternal​FilePermissions​Info Boolean Specifies whether to include permission information, such as whether the file is shared and what are the available permission types, for external files. Optional 35.0
isDataSync Boolean An automated client generates the request. 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
repository​FileId String ID of the external file. Optional 32.0
repository​FileUri String URI of the external file, such as https://drive.google.com/file/d/​0B7a_ei8brT1TMy1CQ0o5NmZQNEE/view. Optional 39.0
repositoryId String ID of the external data source. Required if repositoryFileId is specified. Otherwise, Optional. 32.0
reuseReference Boolean Specifies whether to reuse the latest version of a reference you own to an external file rather than creating a duplicate reference. Optional 36.0
sharingOption String Sharing option of the file. Values are:
  • Allowed—Resharing of the file is allowed.
  • Restricted—Resharing of the file is restricted.
Optional 35.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 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/v39.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--