Skip to main content
12-Amethyst
January 11, 2023
Solved

How to use ExtractZipArchive?

  • January 11, 2023
  • 1 reply
  • 1285 views

Hi All!

I'm currently using Thingworx 8.5.19 version.

The intent is to programmatically (using Thingworx service), unzip a file containing many JSON files, so that we can process the content in the JSON.

Getting below error:
Unable to Invoke Service ExtractZipArchive on SBR.OEMFeed.RawData.Repo : Cannot extract file "Atlas Copco_RawFeed.zip" to target directory "Atlas Copco".

Any lead can be helpful.

Best answer by jensc

Hello,

 

What does your unzip service look like? 

This is one I am using to extract source control files;

let result = Things["SystemRepository"].ExtractZipArchive({
	path: '/RJP_Extracted/' /* STRING */,
	zipFileName: '/RJP_Import/20230110.zip' /* STRING */
});

Where "path" is where you will extract your files and "zipFileName" is the path to where your zip file is.

 

I have a brief memory that I have also had the same error and it was because the path was not correct.

 

Regards,

Jens

1 reply

jensc17-PeridotAnswer
17-Peridot
January 12, 2023

Hello,

 

What does your unzip service look like? 

This is one I am using to extract source control files;

let result = Things["SystemRepository"].ExtractZipArchive({
	path: '/RJP_Extracted/' /* STRING */,
	zipFileName: '/RJP_Import/20230110.zip' /* STRING */
});

Where "path" is where you will extract your files and "zipFileName" is the path to where your zip file is.

 

I have a brief memory that I have also had the same error and it was because the path was not correct.

 

Regards,

Jens