Caching

The API supports caching of lists and items via Last-Modified headers, and via HTTP ETag headers for items.

Last modified time

When requesting a list or an item, a Last-Modified header containing the requested item's last updated time will be included in the response.

If you include a If-Modified-Since header containing a timestamp, the API will check this timestamp against the last modified time for the requested item. If the item has not been modified since this time, the API will respond with a 304 Not Modified status code and the response body will be empty. The request will not count towards the rate limit.

The If-Modified-Since header should contain a timestamp in one of the formats specified in RFC 2616.

Thu, 24 May 2018 17:54:07 GMT
Thursday, 24-May-18 17:54:07 GMT
Thu May  24 17:54:07 2018 GMT

HTTP ETag

When fetching or updating an item or an item's data, the API will include a ETag header containing the SHA-256 hash of the item's data.

When requesting an individual item using the GET lists/{name}/items/{id}, GET lists/{name}/items/{id}/data or GET lists/{name}/items/{id}/data/{path} endpoints, you may include a If-None-Match header containing a hash of the item's data. If this matches the current item's hash then the API will respond with a 304 Not Modified status code and the response body will be empty. The request will not count towards the rate limit.

Example request
$ curl https://jsonpad.io/api/v1.0/lists/testlist/items/23928779684449152 \
	-u username:token \
	-H "Accept: application/json" \
	-H "If-None-Match: 0e988e0e8dec56e3bb331e110109cc24"

If you will be fetching a resource multiple times or if you need to poll a resource regularly (to monitor it for changes, for example) it is suggested that you cache the item and the item's hash or the last modified time, and then use the If-Modified-Since and If-None-Match headers in subsequent requests to reduce the impact on your rate limit.