Endpoint
https://\{instance}.salesforce.com/services/apexrest/cg/SDrive/files
...
POST
Request Body Parameters
objectId : Id of the parent object this file will be uploaded to
Type: string
multipartUpload : Do multipart Upload, used for big files(currently unavailable)
Type : Boolean
fileType : File Object the new files will be uploaded as.
Type: string
fileProperties : JSON array of file metadata of the uploaded files.
Type: fileProperty[]
policyMap : Key value pairs that represent the additional policy parameters used during upload
Type: string[]
Response Body Parameters
uploadRequestInfo : JSON object that details how to upload a file to Amazon S3
Type: uploadRequestInfo[]
policyMap : Map of policy conditions and theirs values that represent the additional policy parameters used during upload (e.g. ('$Content-Disposition', 'attachment; filename)). For more information, visit the Amazon documentation:
http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectPOST.html
FileProperty :
fileName : string
fileLocation : string
description : string
relationshipFieldName : string
fileType : string
fileSizeInBytes : string
UploadRequestInfo :
fileName : string
fileLocation : string
fileSize : string
fileType : string
wipFileId : string
signature : string
policy : string
timeStamp : string
awsRegion : string
awsCredential : string
metadataHeaders: object
s3EncryptionType: string
Status Codes
201 - Object properly created
403 - Wrong input formatting
404 - False objectId
406 - Invalid input
412 - Missing input fields
422 - Wrong input semantics
Usage
Use POST to initiate an upload. Creates File Object records on S-Drive. Follow it by uploading the files using the data in uplodRequestInfo to Amazon S3 then finish with the PUT method. Corresponding field names to AWS form fields are as follows.
fileName : used in Content-Disposition
fileLocation : key
fileType : Content-Type
signature : x-amz-signature
policy : policy
timeStamp : x-amz-date
awsCredential : x-amz-credential
s3EncryptionType: x-amz-server-side-encryptionPUT
Request Body Parameters
wipIds : JSON array of Salesforce ids that have completed their uploads to Amazon S3.
Type: string[]versionIds(Optional) : JSON array of AWS S3 version ids ids that have completed their uploads to Amazon S3.
Type: string[]
Response Body Parameters
resultObjects : JSON object that details the status of each file's upload request.
Type: resultObject[]
ResultObject
status : string ( success or fail)
error message : string ( empty if status is success)
wipField : string ( to see which file failed)
Status Codes
200 - Upload complete
403 - Wrong input formatting
404 - False wipIds
422 - Wrong input semantics
Usage
Done after the POST method and uploading files to the correct location in Amazon S3.DELETE
Request Query Parameters
objectId : Id of the parent object.
wipId : Salesforce id of the object that will be deleted from S-Drive and Amazon S3.
Response Body Parameters
resultObjects : JSON object that details the status of each file's delete request.
Type: ResultObject[]
ResultObject
status : string ( success or fail)
error message : string ( empty if status is success)
wipField : string ( to see which file failed)
Status Codes
200 - Object deleted
403 - Wrong input formatting
404 - False objectIds
422 - Wrong input semantics
Usage
Deletes the File from Amazon S3 then removes the file record from Salesforce