Skip to main content
12-Amethyst
Jan 11, 2023 2:42 PM UTC
Solved

How to use ExtractZipArchive?

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.

jenscAnswer
17-Peridot
Jan 12, 2023 7:21 AM UTC

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
Jan 12, 2023 7:21 AM UTC

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

Translate