Upload Object to Existing Bucket
This API enables clients to initiate a two-step process to upload files to an existing bucket.
Step 1: Generate Upload URL
Call this API https://api.e2enetworks.com/myaccount/api/v1/storage/urls/object/
to generate a pre-signed URL for uploading a file (valid for 300 seconds).
Response Fields:
data– The pre-signed URL to be used in the subsequent HTTP PUT step.
Step 2: Upload the File (Binary Format)
Once the pre-signed URL is received, you can upload your file in binary format using any HTTP client such as curl, Postman, or programmatically in your preferred language.<br>
Note: The file name should be same as the object_name provided in https://api.e2enetworks.com/myaccount/api/v1/storage/urls/object/.
The following code snippets are provided for illustration:
Python (using requests)
import requests
upload_url = "<paste-upload-url-here>"
file_path = "path/to/your/file.txt"
with open(file_path, "rb") as f:
response = requests.put(upload_url, data=f)
print("Status Code:", response.status_code)
JavaScript (using fetch)
const fs = require("fs");
const axios = require("axios");
const uploadUrl = "<paste-your-presigned-url-here>";
const filePath = "path/to/your/file.txt";
const uploadFile = async () => {
try {
const fileStream = fs.createReadStream(filePath);
const response = await axios.put(uploadUrl, fileStream, {
headers: {
"Content-Type": "application/octet-stream"
},
maxBodyLength: Infinity
});
console.log("Upload status code:", response.status);
console.log("Upload successful!");
} catch (error) {
console.error("Upload failed:", error.response?.status, error.message);
}
};
uploadFile();
/storage/urls/object/Query parameters
bucket_nameQuerystringrequiredBucket Name
object_nameQuerystringrequiredObject Name with Directory.
methodQuerystringrequiredMethod
examplePUTproject_idQueryintegerrequiredProject ID Find your project id here
locationQuerystringrequiredLocation (Delhi and Chennai)
Responses
200Successfully generated a pre-signed URL for object upload
200https://objectstore.e2enetworks.net/sdaf/config%20%286%29.json?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=...Any error details encountered during URL generation
Success