REST API download image (export)

Hey,

I’m trying to download image from URL
https://1.1.1.1:8443/1.0/images/{fingerprint}/export

The image is set to public, however when I access the URL i get one file which i cannot extract. I’ve done a bit looking and found out that in the first 20 lines, some of them contain the following:

--d04421f0f6ed75b068f3670e1534aaa80fcf9f4faf168e3e203e66cbf428
Content-Disposition: form-data; name="rootfs"; filename="d683477cdda7cedfdb571fb972c0281312e24baa8596382bbcfa6baa1d68cebf.squashfs"
Content-Type: application/octet-stream

Is there a trick or something that i haven’t read in the documentation.

LXD version: 2.0.11
Host OS: Ubuntu 16

That’s a valid HTTP response for a multi-file transfer.

You’re getting this response as the image you’re downloading is made of more than one file.

Our client tool obviously has the needed logic to split things up after download but since you’re doing it manually, you’d have to do so yourself.

There should be http multipart parsing libraries in most languages.

You can also do it by hand by manually splitting the file wherever you see the multipart header and then strip those headers out from the files.