curl --request GET \ --url 'https://api.e2enetworks.com/myaccount/api/v1/storage/urls/object/?bucket_name=<BUCKET_NAME>&object_name=<OBJECT_NAME>&method=PUT&project_id=<PROJECT_ID>&location=<LOCATION>&apikey=<API_KEY>' \ --header 'Authorization: Bearer <API_TOKEN>'import requests
response = requests.get( "https://api.e2enetworks.com/myaccount/api/v1/storage/urls/object/", params={"bucket_name": "<BUCKET_NAME>", "object_name": "<OBJECT_NAME>", "method": "PUT", "project_id": "<PROJECT_ID>", "location": "<LOCATION>", "apikey": "<API_KEY>"}, headers={"Authorization": "Bearer <API_TOKEN>"},)print(response.json())const url = new URL("https://api.e2enetworks.com/myaccount/api/v1/storage/urls/object/");url.search = new URLSearchParams({ bucket_name: "<BUCKET_NAME>", object_name: "<OBJECT_NAME>", method: "PUT", project_id: "<PROJECT_ID>", location: "<LOCATION>", apikey: "<API_KEY>" });
const response = await fetch(url, { method: "GET", headers: { "Authorization": "Bearer <API_TOKEN>" },});console.log(await response.json());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.
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();
Parameters
Section titled “Parameters”Query Parameters
Section titled “Query Parameters”Bucket Name
Object Name with Directory.
Method
Example
PUTProject ID Find your project id here
Deployment region for the resource. Accepted values: Delhi, Chennai.
Mumbai region has been discontinued. Delhi and Chennai are the only supported regions.
Responses
Section titled “Responses”Successfully generated a pre-signed URL for object upload
object
Any error details encountered during URL generation
object
Example
{ "code": 200, "data": "https://objectstore.e2enetworks.net/sdaf/config%20%286%29.json?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=...", "errors": {}, "message": "Success"}