cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community email notifications are disrupted. While we are working to resolve, please check on your favorite boards regularly to keep up with your conversations and new topics.

Re: How to send a file to AWS S3 via Content Loader Functions

VP_8991104
11-Garnet

Re: How to send a file to AWS S3 via Content Loader Functions

As per the original post

 

Hi  willie.  The following is my service, to upload my csvfile from repository to s3Bucket.But i am not able to upload it from my service.

 

 

try {

	var FolderName = Company + " Stocks";
	logger.debug("FolderName :" + FolderName);
	var ESSSIMDetailsFilePath = FolderName + "/" + Company + "_SIMDetails.csv";
	logger.debug("ESS SIM DetailsFilePath :" + ESSSIMDetailsFilePath);


	// Content: BLOB
	var Content = Things["SystemRepository"].LoadBinary({
		path: FolderName /* STRING */
	});

	var headers = {
		'Content-Type': 'text/csv'
	};




	// result: BLOB
	var result = Resources["ContentLoaderFunctions"].PutBinary({
		proxyScheme: undefined /* STRING {"defaultValue":"http"} */ ,
		headers: headers /* JSON */ ,
		ignoreSSLErrors: undefined /* BOOLEAN */ ,
		useNTLM: undefined /* BOOLEAN {"defaultValue":false} */ ,
		workstation: undefined /* STRING {"defaultValue":""} */ ,
		useProxy: undefined /* BOOLEAN {"defaultValue":false} */ ,
		proxyHost: undefined /* STRING {"defaultValue":""} */ ,
		url: "https://s3.console.aws.amazon.com/s3/buckets/stocman-files-backup?region=ap-south-1&tab=objects" /* STRING */ ,
		content: Content /* BLOB */ ,
		timeout: undefined /* NUMBER {"defaultValue":60} */ ,
		proxyPort: undefined /* INTEGER {"defaultValue":8080} */ ,
		password: undefined /* STRING */ ,
		domain: undefined /* STRING {"defaultValue":""} */ ,
		username: undefined /* STRING */
	});


} catch (error) {
	logger.error("Trial Service : The error is " + error + " in line number " + error.lineNumber);
}

 

 

 

2 REPLIES 2

Hi @VP_8991104 

 

It seems you're missing authorization info.  It can be provided in a couple of ways: presigned url or header-based authorization.  

Hi willie

 

I am trying to create presigned url.But I am not able to create. That option is disabled. Can you suggest any other wayScreenshot 2023-10-10 104242.png

Top Tags