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

Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X

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

VP_8991104
12-Amethyst

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.  

VP_8991104
12-Amethyst
(To:Willie)

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

Announcements


Top Tags