Newer Version Available
Initialize the Upload
When a user selects a file, the LWC first retrieves the S3 upload parameters using the
Salesforce Connect API.
This retrieval is done through an Apex class (ConnectApiHelper) that calls the initializeFileUpload method. See initializeFileUpload(inputRep) to learn about the signature and parameters of the method.
Single-Part Upload Response
Used for files less than or equal to 100 MB. The response contains a single fileUploadUrl.
1{
2"code": 200,
3"contentHubUploadUrlRepresentations": [],
4"fileId": "__sfdcroot__/Case/500SG000010DywSYAS/filename.txt",
5"fileName": "filename.txt",
6"fileUploadUrl": "https://<aws-bucket>.s3.us-east-2.amazonaws.com/...",
7"message": "Initiate request for External file upload has been successfully completed for fileName: filename.txt",
8"isMultiPartUpload": false,
9"partSize": 0,
10"repositoryId": "0XCSG0000002jfN",
11"uploadId": null
12}Multi-Part Upload Response
Used for files greater than 100 MB. The file is split into 100 MB chunks and the response provides an array of partUrl entries and an uploadId.
1{
2//upload urls for each chunk
3"code": 200,
4"contentHubUploadUrlRepresentations": [
5{ "partNumber": 1, "partUrl": "https://<aws-bucket>.s3.us-east-2.amazonaws.com/..." },
6{ "partNumber": 2, "partUrl": "https://<aws-bucket>.s3.us-east-2.amazonaws.com/..." }
7// ...
8],
9"fileId": "__sfdcroot__/Case/500SG000010DywSYAS/filename.mov",
10"fileName": "filename.mov",
11"fileUploadUrl": null,
12"isMultiPartUpload": true,
13"message": "Initiate request for External file upload has been successfully completed for fileName: filename.mov",
14"partSize": 104857600,
15"repositoryId": "0XCSG0000002jfN",
16"uploadId": "7WOBJuX30tzKY9fVBWdH9vaoQM0GDzFlI3o4ZPCjI7U4byCSdgMBjUhYGBx7..."
17}