Extracting an xml file from a zip behind basic auth

Hi all,

I have a nice XProc 1.0 script that interacts with a REST API behind 
basic auth. I provide base64 encoded credentials and the pipeline 
happily parses the xml response bodies, follows link relations, 
recursively follows pagination links, constructs its own request bodies 
to POST and so on. Everything is great except for one awkward part: The 
API provides access to zip files containing a bundle of resources, 
including some XML files that I need. I was hoping I could use pxp:unzip 
providing the url of the zip, but I have provide the authentication 
header as well. Should I use p:http-request and send the result of that 
to pxp:unzip? Unfortunately p:http-request doesn't seem to like hitting 
an endpoint that gives it non-xml content. What's the right approach? Is 
there an example of how to do this?

For now, I've just done p:exec to call curl, get the zip on the 
filesystem, and pxp:unzip it from there, but it seems so inelegant 
compared to everything else.

Regards,

David

Received on Friday, 14 April 2023 18:26:17 UTC