Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X
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?
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
Thanks a lot. You made my day.