Skip to main content
14-Alexandrite
February 16, 2021
Solved

Access repository files from other things

  • February 16, 2021
  • 1 reply
  • 1968 views

Hi All,

We'd like to access files in repository folder of ThingA from another things which are in the same project like ThingB.

Can we do that ?

 

img.PNG

 

Best answer by suverma

Hi @Yoshihiko.N 

 

This is definitely possible to copy files from one Repository to another. Please refer to this  link for more details on how to achieve this use-case.

 

You can also make use of Copy Service of FileTransferSubsystem which gives an option to select source and target repository.

 

Do revert back for further query.

1 reply

suverma14-AlexandriteAnswer
14-Alexandrite
February 16, 2021

Hi @Yoshihiko.N 

 

This is definitely possible to copy files from one Repository to another. Please refer to this  link for more details on how to achieve this use-case.

 

You can also make use of Copy Service of FileTransferSubsystem which gives an option to select source and target repository.

 

Do revert back for further query.

14-Alexandrite
February 18, 2021

@suverma 

Thank you for your quick response.

I confirmed we can use "copy" service in "FileTransferSubsystem".
and I have one more question.

 

How can we call the copy service from services in other things ?

if you provide me code example, I'd be happy.

img.PNG

14-Alexandrite
February 18, 2021

Hi @Yoshihiko.N 

 

You can try something like below in your custom service where Thing A and Thing B can be your source and target repository: 

Spoiler

var params = {

async: false /* BOOLEAN */,

sourceRepo: "RepoThing" /* STRING */,

targetRepo: "TargetRepo" /* STRING */,

targetFile: "Openssl command.txt" /* STRING */,

targetPath: "/" /* STRING */,

sourceFile: "Openssl command.txt" /* STRING */,

sourcePath: "/" /* STRING */,

timeout: undefined /* INTEGER */

};

// result: INFOTABLE dataShape: FileTransferJob

var result = Subsystems["FileTransferSubsystem"].Copy(params);