finishUpload mutation
The finishUpload mutation completes the file upload process initiated by the initiateUpload mutation. The finishUpload mutation requires the unique key generated during the initiation step as an input parameter. This key identifies the file that was uploaded to the Amazon S3 bucket.
When you call this mutation, Commerce verifies that the file associated with the provided key has been successfully uploaded to the S3 bucket. If the upload is confirmed, Commerce finalizes the upload process and makes the file available for use within the system. The response from the finishUpload mutation includes the unique key for the uploaded file. Use this key to reference the file in subsequent operations, such as associating it with a customer file or image attribute.
Syntax
Copied to your clipboardmutation {finishUpload(input: finishUploadInput!): finishUploadOutput}
Example usage
The following examples show how to finalize an upload for different types of files.
Finalize an upload for a customer attribute file
The following mutation finalize an upload for a file with a key value of cat_106d42b2ee34de81db31d958.jpg.
Request:
Copied to your clipboardmutation Finish($input: finishUploadInput!) {finishUpload(input: $input) {successkeymessage}}
The $input variable contains:
Copied to your clipboard{"input": {"key": "cat_106d42b2ee34de81db31d958.jpg","media_resource_type": "CUSTOMER_ATTRIBUTE_FILE"}}
Response:
Copied to your clipboard{"data": {"finishUpload": {"success": true,"key": "cat_106d42b2ee34de81db31d958.jpg","message": "Upload completed successfully."}}}
Finalize an upload for a negotiable quote attachment
The following mutation finalizes an upload for a file with a key value of test-document1_32cb1fe50dab390be841461e.txt.
Request:
Copied to your clipboardmutation {finishUpload(input: {key: "test-document1_32cb1fe50dab390be841461e.txt",media_resource_type: "NEGOTIABLE_QUOTE_ATTACHMENT"}) {successkeymessage}}
Response:
Copied to your clipboard{"data": {"finishUploadOutput": {"success": true,"key": "test-document1_32cb1fe50dab390be841461e.txt","message": "File upload confirmed successfully."}}}
