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

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

Service to return a file type

arunkumar1
1-Newbie

Service to return a file type

Hi,

I wanted to create a service that returns a PDF file. I have a PDF file stored in MyFileRepository thing.

I used GetFileListingWithLinks service which returns the following URL and with which I can download:

     http://myserver/Thingworx/FileRepositories/MyFileRepository/Test.pdf

However, I don't want to expose MyFileRepository thing and also the above URL.

what should be the service output type for responding file? And the client when invoking the service through REST what should be the Accept header?

5 REPLIES 5

I had the same problem.

The only answer I got from the PTC suport was : It is not currently possible to do that with Thingworx, but the R&D is working on it.

The only solution I see but that I did not test because of a lack of time is to create a custom widget button that would have you data as entry. Then, when it is pressed, you submit a form created on the fly with your data as parameter that you submit through a POST to a custom servlet that you would deploy on your tomcat server.

I tried to call a servlet from within a Thingworx service, don't waste your time, Thingworx will get the file but you won't be able to propagate it to the client browser.

There is no good solution currently. You could copy the file to a new FileRepo that you don't mind having public, while keeping the secured one...secure. It's good to hear R&D is on this though

How can I make MyFileRepository public?

In the sense, I wanted to make the URL accessible without authentication.

     http://myserver/Thingworx/FileRepositories/MyFileRepository/Test.pdf

Right now, when I paste the above URL in browser, it prompts for username and password.

or can I pass authentication as URL parameters like"

     http://myserver/Thingworx/FileRepositories/MyFileRepository/Test.pdf?username=<myusername>&password=<mypassword>


Thanks.

Arunkumar D

You can try passing an appKey: Re: Customer Login

Thanks a lot. You made my day.

Top Tags