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

Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X

Download external file using TWX service

SC_10367484
1-Newbie

Download external file using TWX service

Hello All,

 

I wanted to download external file in twx repository using service 

so basically i need code snippet to download this file in TWX Service using link and save to repo

 

Any help appreciated ! 

 

 

ACCEPTED SOLUTION

Accepted Solutions
nmutter
14-Alexandrite
(To:SC_10367484)

The Resource ContentLoaderFunctions does offer services like LoadBinary, LoadImage, ...

There are some examples here: https://community.ptc.com/t5/IoT-Tips/ContentLoaderFunctions-in-ThingWorx/ta-p/820230

View solution in original post

2 REPLIES 2
nmutter
14-Alexandrite
(To:SC_10367484)

The Resource ContentLoaderFunctions does offer services like LoadBinary, LoadImage, ...

There are some examples here: https://community.ptc.com/t5/IoT-Tips/ContentLoaderFunctions-in-ThingWorx/ta-p/820230

I found below solution working for me

 

// remoteFileUrl : link for file to be download

// MyFileRepository : Repo name

 

// result: BLOB
var result =  Resources["ContentLoaderFunctions"].LoadBinary({
ignoreSSLErrors: true /* BOOLEAN */,
url: remoteFileUrl /* STRING */,
});
 
 Things["MyFileRepository"].SaveBinary({
path: 'File1.docx' /* STRING */,
content: result /* BLOB */
});
Announcements


Top Tags