Skip to content

Upload Object to Existing Bucket

GET
/api/v1/storage/urls/object/
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>'

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();
bucket_name
required
string

Bucket Name

object_name
required
string

Object Name with Directory.

method
required
string
Allowed values: PUT

Method

Example

PUT
project_id
required
integer
location
required
string
Allowed values: Delhi Chennai

Deployment region for the resource. Accepted values: Delhi, Chennai.

Mumbai region has been discontinued. Delhi and Chennai are the only supported regions.

Successfully generated a pre-signed URL for object upload

Media typeapplication/json
object
code
integer
data
string format: uri
errors

Any error details encountered during URL generation

object
key
additional properties
any
message
string

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"
}