โ02-04-2019 11:13 AM
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.
Solved! Go to Solution.
โ02-05-2019 11:20 AM
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.
Iโm attaching the example pipeline as well:
RestGetZip_2019_02_05.slp (9.1 KB)
โ02-05-2019 11:20 AM
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.
Iโm attaching the example pipeline as well:
RestGetZip_2019_02_05.slp (9.1 KB)
โ02-06-2019 07:19 AM
Thank you for detailed info. It helped a lot! Regina