Files API

The ZEST Files API implements a class-1 WebDAV server, allowing you direct access to the files and images associated with a ZEST site.

While the Data API provides you the ability to create products, categories (and even pages), unless you manually import imagery and files, you will need to use the files API to upload any imagery associated with those resource entries.

The Files API has been in production use for some time, but access is restricted to specifically approved customers. If you need access, please contact us to discuss your requirements.

Getting started

Once approved, make sure you read our getting started documentation to learn how to gain access to our APIs, and authenticate a request.

Endpoint

The files API is accessible at https://<api key>:@secure.zeald.com/files/<site_name>/. To work out the site_name for the site you are builing, either contact us, or you may be able to determine it from the URLs of existing files & images on the websites which are usually of the format https://images.zeald.com/site/<site_name>/images/some-image.jpg.

As with all of the ZEST APIs, authentication is over basic HTTP authentication, with your application key as the username and no password (or any password you like, if the app you are using requires a password - the password is ignored).

Clients

The webdav client API is well tested with a few clients: it should work fine with any standards compliant Class-1 webdav implementation but it most likely will not work with clients that use non-standard webdav extensions.

Different tools we have explicitly tried include:

  • Curl can upload files to webdav: curl -T <filename> https://<api key>:@secure.zeald.com/files/<site name>/
  • From the Linux/Unix command line, and scripts on these platforms, try https://notroj.github.io/cadaver/. It provides an ftp-client like interface.
  • All clients based on the Neon webdav library https://notroj.github.io/neon/ - this includes most Linux/Unix based webdav implementations.
  • WinSCP supports WebDAV.

Scripting WebDAV with raw HTTP requests

WebDAV is a very simple extension to HTTP. Below are some examples of how you do common tasks you may need.

Upload a file

To upload a file, do an HTTP PUT request with the file as the body. To do this using curl:

curl -T <filename> https://<api key>:@secure.zeald.com/files/<site name>/<directory>/

Directory list

To list all files in a directory, submit a GET request to https:<api key>:@secure.zeald.com/files/<site name>/. To do this with curl:

curl https:<api key>:@secure.zeald.com/files/<site name>

This will return something like:

<a href="./">./</a><br>
<a href="../">../</a><br>
<a href="files/">files/</a><br>
<a href="graphs/">graphs/</a><br>
<a href="images/">images/</a><br>
<a href="inc/">inc/</a><br>
<a href="test.txt">test.txt</a><br>

You can browse this in a webbrowser as well.

Fetch a file

To fetch a file, use an HTTP GET request:

GET https://<api key>:@secure.zeald.com/files/<site name>/<filename>

With curl:

curl https://<api key>:@secure.zeald.com/files/<site name>/<filename> > <local filename>

Delete a file

To delete a file, simply submit a DELETE to the file endpoint:

DELETE https://<api key>:@secure.zeald.com/files/<site name>/<filename>