How to upload/download media in Object Storage
Last updated
Last updated
Using Object storage API to store file
After creating the APIs for the Object storage through API templates, you can start uploading your files directly to the bucket using the UPLOAD API.
From your client / Front-end, make a POST request to your UPLOAD API endpoint, with the following
This request will then generate a Presigned URL and a set of form values that can be used to upload the file. Using the URL and form values, upload your file to the bucket.
After successfully uploading the file, you can make a GET request to the Object Storage DOWNLOAD API to retrieve the file.
file name (with extension; i.e - jpg,mp3,mp4 etc.) and file size (exactly in bytes) as request body.
After successfully uploading the file in the bucket, you can retrieve the file by making a GET request to the API with the name of the file as a query parameter from your client, make a GET request to your DOWNLOAD API endpoint with the file's name to retrieve as a query param.
That request will then generate a URL that can be used to download/access the file.
Sometimes we have files that are not being used anymore and take up the space in our bucket. In such a case, we can utilize the DELETE method to remove the file from the bucket.
To Delete files/files from your bucket make a DELETE request from your client with an array of strings as the request body with the name “objects to delete”.