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

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

How to get absolute path of ThingWorx Repository ?

rsanap
1-Visitor

How to get absolute path of ThingWorx Repository ?

         I need absolute path of ThingWorx repository in one of service, how i can get it in service? As of now I have added hard coded value for it (C:\\ThingworxStorage\\repository\\).

Also is there any inbuilt function to get file separator for underlying operating system. I have added hard coded value for it (fileSeparator=”\\”).

12 REPLIES 12
AdamR
14-Alexandrite
(To:rsanap)

Ramesh,

There is no service function to get an absolute path or file separator.  We do not want to expose any underlying OS or file system structure via Thingworx as in some cases it is considered a potential security issue.  All access is therefore controlled via Thingworx and its security structure,

qn
12-Amethyst
12-Amethyst
(To:rsanap)
ss1
1-Visitor
1-Visitor
(To:rsanap)

Could anyone please guide me to identify the absolute path of repository of ThingWorx instance running on cloud like (ge2-xxx.cloud.thingworx.com)...

PaiChung
22-Sapphire I
(To:ss1)

What is the use case? Why would you need the absolute path?

You can get paths to files in the FileRepository using the GetFileListingWithLinks service for example, those would be URLs

ss1
1-Visitor
1-Visitor
(To:PaiChung)

Thanks for prompt reply Pai... The use case is :

1. I wanted to upload files to ThingWorx cloud repository.

2. Later I wanted to download those from my android mobile , or in my raspberry pi gateway.

My guess is , if I can obtain the absolute path - i can use rest service to download the files.

PaiChung
22-Sapphire I
(To:ss1)

Are you saying you want to download these files without going through Thingworx?

That doesn't seem secure.

I recommend using the Thingworx FileRepository URLs and have them provide user and password.

ss1
1-Visitor
1-Visitor
(To:PaiChung)

When I am trying to access the fileRepository URL using rest, it is prompting for username and password.

When I enter my creds it does not login...

This happens with my cloud instance as well.  When I directly hit my cloud instance http://ge2-5506.cloud.thingworx.com/Thingworx/Composer/index.html on browser, it prompts for username and password - when I enter correct details... it does not login and continously prompts for credentials.

However, when I login into my account , and select a application and then go to platform it successfully logins into cloud instance composer.

Why does it happen? Please guide me...

Thanks in advance!!

PaiChung
22-Sapphire I
(To:ss1)

If you use the Link given from getfilelistingwithlinks, it should directly open or download the file it points to without needing a session.

If you point to the FileRepository itself, it wants to establish a session.

if it isn't properly behaving for you like that, you might consider using an appkey and pass that in with the call.

ss1
1-Visitor
1-Visitor
(To:PaiChung)

Thanks...that worked!!

If you build a Server Side Extension ( java ) you can easily get it with:

ApplicationContext.getInstance().getRepositoryDirectory()

ss1
1-Visitor
1-Visitor
(To:CarlesColl)

Thanks.....

Hi there,

The whole class com.thingworx.system.ApplicationContext seems to be gone in Thingworx Extensions SDK 7.1. How can I get the repository directory now?


Thank you,

João

Announcements


Top Tags