SuperYacht Times API

Caching and compression

Compression

Send Accept-Encoding: gzip on every request.

  • /yachts/{id} is stored compressed. With Accept-Encoding: gzip you receive it as it is stored, with Content-Encoding: gzip. Without it, the API decompresses it for you.
  • The lists are compressed when you accept gzip and the body is about 1 KB or larger. A full list is much larger than that.

Most HTTP clients decompress for you when you enable it, for example curl --compressed.

ETag and If-None-Match

/yachts/{id} answers with a weak entity tag:

ETag: W/"5d41402abc4b2a76b9719d911017c592d41402abc4b2a76b9719d911017c592"

Store it with the record. Next time, send it back:

If-None-Match: W/"5d41402abc4b2a76b9719d911017c592d41402abc4b2a76b9719d911017c592"
  • If the record has not changed, the API answers 304 Not Modified with no body. Keep your copy.
  • If it has changed, you get 200 with the new record and a new ETag.

The tag is the same whether the body was compressed or not, and the W/ prefix is optional in If-None-Match. The lists and find endpoints carry no ETag.

Cache headers

Every response has Cache-Control: private and Vary: Accept-Encoding. The data is licensed to your key: do not put it in a shared or public cache.

How often data changes

Changes in the SuperYacht Times database reach the API within about ten minutes. A sync every ten minutes or less often is enough; most partners sync hourly or daily.