Skip to main content
Skip table of contents

Upload Automation

This documentation aims to guide the users to write a simple script to automatically upload files to Eagle 3D Streaming

POWERSHELL
GET https://upload-api.eagle3dstreaming.com/api/v2/external/upload-url

Request

Query Parameters

Key

Value

Description

apiKey

YOUR API KEY

Secret API key provided by E3DS. To find more on API key read this document.

appName

YOUR APP NAME

The name of the application

fileSize

SIZE

Size of file in GB

API key can be found by following this doc : Getting API Key


Response

Success Response

Status Code 200 OK 

Example Response

JSON
{
    "status": "success",
    "data": {
        "filePath": "owner-name/app-name/1.zip",
        "url": "https://storage.googleapis.com/e3ds-master.appspot.com/owner-name/app-name/1.zip?X-Goog-Algorithm=GOOG4-RSA-SHA256&X-Goog-Credential=642640802991-compute%40developer.gserviceaccount.com%2F20231212%2Fauto%2Fstorage%2Fgoog4_request&X-Goog-Date=20231212T161235Z&X-Goog-Expires=900&X-Goog-SignedHeaders=content-type%3Bhost&X-Goog-Signature=42dffe760fe6d64538f8f49d609cd08d60ffbce7e32ac208d437c082692ead2a1f4a9900a78b220e5059463f1743d09e1f8285c420283fe45c0ce25726d632aec1f7847b792312e645ece331afcce0fa7191d385ebe61bec8ee646cee093f68a3f890b6222f7e8a595babd405fb6f4d0bd43b6ee5b7a2d7956b79433c5657d2338d7b7830a20129262a1dab1977d28491174be3e897a0561828cd52a3398c5989f0f023e441832a85e145ab56ec324889d4c6affabbf3742c1bbcf23cda8ac5e5f7ebdb16e8bf989cb4dfdadc3eb1cd4d65b6a16297d9ebb921b97055d46b856351c9673b9b33ca46874071a417ed0f1dd5f8a37d3e06e979ea8e7b5771d2294",
        "willOverwrite": false
    }
}

Error Response

Status Code 400 Bad Request 500 Internal Server Error

Example Response 400 Bad Request

JSON
{
    "status": "error",
    "message": "appName is missing from the request query"
}

Example Response 500 Internal Server Error

JSON
{
    "status": "error",
    "message": "Decryption error : error decrypting"
}

Guideline to produce script in any programming environment (Js/PHP/Ruby/Python)

  • Fetch the upload link by using the URL mentioned in the top of the documentation

  • Setup a network call with the following configuration:

    • METHOD: PUT

    • URL: Upload Link fetched from the previous step

    • Data aka Request Body: A stream of the file to be uploaded

    • Headers:

      • Content-Type: 'application/octet-stream'

      • x-ms-blob-type: 'BlockBlob'

      • Content-Length: Size of the file to be uploaded in bytes

  • Run the code. Happy Uploading !!!


Examples

Node.js

JS
const axios = require('axios')


const fs = require('fs');

const filePath = 'path/to/your/file'; // Replace with the actual file path
const stat = fs.statSync(filePath);
const sizeInBytes = stat.size;

// Convert bytes to gigabytes
const sizeInGB = sizeInBytes / (1024 * 1024 * 1024);

console.log(`File size: ${sizeInGB.toFixed(2)} GB`);

	
	// Get the size of the file
    const size = fs.statSync(filePath).size;

axios.get('https://upload-api.eagle3dstreaming.com/api/v2/external/upload-url', {
    params: {
        apiKey: "YOUR_API_KEY", // Replace with your E3DS Api Key
        appName: "app-name",
        fileSize: sizeInGB // note: File Size must be in GB here
    }
}).then(function (response) {
    console.log("Received Upload Url");
    const uploadUrl = response.data.data.url;
    

    // Create a stream of the file
    const stream = fs.createReadStream(filePath);
  
    
    // Upload the file 
    axios.put(uploadUrl, stream, {
        headers: {
            'Content-Type': 'application/octet-stream',
            'x-ms-blob-type': 'BlockBlob',
            'Content-Length': sizeInBytes //note: File Size must be in bytes here
        }
    }).then(response => {
        console.log('File uploaded successfully', response.data);
    }).catch(error => {
        console.error('Error uploading file', error);
    });
}).catch(function (error) {
    console.log("An Error Occured");
    console.log(error);
})

cURL:
File size in GB. Put your file size manually.

CODE
curl "https://upload-api.eagle3dstreaming.com/api/v2/external/upload-url?apiKey=YOUR_API_KEY&appName=app-name&fileSize=4.6"




JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.