Toshl Developer

Caching

Most API endpoints return either an ETag or a Last-Modified header. You are encouraged to use conditional requests and cache resources and lists of resources on your client.

Making a conditional request and receiving a 304 response does not count against your Rate Limit, so we encourage you to use it whenever possible.

Last-Modified

The Last-Modified header applies to response messages only. The value of this response header indicates the last time a specific resource or a group of resources was last changed. It may then be used to retrieve values from the server only if something changed on the server in the meantime.

Example

GET /entries HTTP/1.1
HTTP/1.1 200 OK
Date: Wed, 22 Aug 2012 21:22:53 GMT
Server: Apache
Last-Modified: Thu, 09 Aug 2012 09:10:06 GMT
Content-Length: 1150
Content-Type: application/json

Subsequent request:

GET /entries HTTP/1.1
If-Modified-Since: Thu, 09 Aug 2012 09:10:06 GMT
HTTP/1.1 304 Not Modified

ETag

Similar mechanism can be used with the ETag header.

Example

GET /entries HTTP/1.1
HTTP/1.1 200 OK
Date: Wed, 22 Aug 2012 21:22:53 GMT
Server: Apache
ETag: "09e0cac7cf33d7334439d079de305c2d"
Content-Length: 1150
Content-Type: application/json

Subsequent request:

GET /entries HTTP/1.1
If-None-Match: "09e0cac7cf33d7334439d079de305c2d"
HTTP/1.1 304 Not Modified