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

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

How to access s3 bucket files via REST API with AWS signature Authentication in Thingworx

VV_10743662
8-Gravel

How to access s3 bucket files via REST API with AWS signature Authentication in Thingworx

Hi Folks,

 

I am trying to access the file stored in s3 bucket in Thingworx via the AWS signature authentication. But I am unable to access the file. I tried to pass the AWS signature in the Header in below format:

let header = {
             "Authorization": {

                             "AccessKey": + accessKey,
                             "SecretKey": + secretKey
                             }
               };

 

let params = {
proxyScheme: undefined /* STRING {"defaultValue":"http"} */,
headers: header,
ignoreSSLErrors: undefined /* BOOLEAN */,
useNTLM: undefined /* BOOLEAN {"defaultValue":false} */,
workstation: undefined /* STRING {"defaultValue":""} */,
useProxy: undefined /* BOOLEAN {"defaultValue":false} */,
proxyHost: undefined /* STRING {"defaultValue":""} */,
url: "http://localhost:9000/bucket1/"+fileName /* STRING */,
timeout: undefined /* NUMBER {"defaultValue":60} */,
proxyPort: undefined /* INTEGER {"defaultValue":8080} */,
password: undefined /* STRING */,
domain: undefined /* STRING {"defaultValue":""} */,
username: undefined /* STRING */
};
 
// result: IMAGE
let result = Resources["ContentLoaderFunctions"].LoadImage(params);
 
I am getting the below error: :JSON does not allow non-finite numbers.
 
Can somebody tell me what is wrong in my request or how to pass the AWS signature while making a REST call?
 
Thanks in advance.
3 REPLIES 3

Unfortunately it's more complex than that. AWS requires you to sign REST requests, see https://docs.aws.amazon.com/AmazonS3/latest/API/RESTAuthentication.html. It won't allow you pass your secret key in HTTP header. Long story short, you have to use a proper AWS client. I'm not aware of any public AWS S3 extensions, although every ThingWorx developer seems to have written at least one in scope of some commercial project. Unless you are lucky and find one, you'd need to implement it yourself.

 

/ Constantine

Hi @VV_10743662,


I wanted to see if you got the help you needed.


If so, please mark the appropriate reply as the Accepted Solution or please feel free to detail in a reply what has helped you and mark it as the Accepted Solution. It will help other members who may have the same question.
Please note that industry experts also review the replies and may eventually accept one of them as solution on your behalf.


Of course, if you have more to share on your issue, please pursue the conversation.

Thanks,

Catalina
PTC Community Moderator
Announcements


Top Tags