When an object upload is completed, the OSS can provide a callback to the application server. To implement the callback, you only need to attach the relevant Callback parameter to the request sent to the OSS. APIs that currently support callbacks include PutObject, PostObject, and CompleteMultipartUpload.
A typical use case for upload callback is to work with the upload by an authorized third-party. The client specifies the callback of the server when it uploads objects to the OSS. After the upload task of the client is completed in the OSS, the OSS automatically initiates an HTTP request for the callback to the application server. This promptly notifies the server that the upload is completed, so the server can complete operations such as database modifications. When the callback request receives a response from the server, the OSS returns the status to the client.
When the OSS sends a POST callback request to the application server, the POST request’s body contains some parameters that carry certain information. Such parameters are divided into two types: system-defined parameters (such as bucket name and object name) and user-defined parameters. You can specify user-defined parameters based on the application logic when sending a request including callback to the OSS. You can use user-defined parameters to carry information relevant to the application logic, such as the user ID of the request initiator. For information on user-defined parameter usage, see Callback.
Appropriate use of the upload callback can decrease the complexity of the client’s logic and reduce the consumption of network resources. The process is as follows: