Using REST GET to read zip output

Hello All,

I have a requirement where I am getting a response from a REST GET as a ZIP file.
REST GET snap returns error when it tries to read ZIP output. Please see screenshots below. Can you please let me know what should be done to allow REST Get to process ZIP output? Any help to solve this issue would be highly appreciated.

Thank you!

Regina K.



1 Like

The error is due to the REST snap trying to interpret the response as JSON. You’ll need to change the ‘Response entity type’ option to ‘BINARY’ to get the snap to work. However, once that is done, you’ll need to jump through a couple of hoops to get the zip unpacked. It turns out the ZipFileRead snap can only read from a file, so you’ll need to write out the binary from the REST snap. To write out the binary data, you can use a DocumentToBinary snap to turn the document into a binary document and then a FileWriter that writes to the pipeline temporary directory. Finally, the ZipFileRead snap can read that file and you can do stuff after that.

08

I’m attaching the example pipeline as well:

RestGetZip_2019_02_05.slp (9.1 KB)

2 Likes

Thank you for detailed info. It helped a lot! Regina