Toshl Developer

Sync

If you are building a client capable of caching a local version of server data for the purpose of use in offline mode, the need for a syncing mechanism becomes apparent.

Toshl API supports syncing with the use of two parameters which you send when making GET list requests: since and include_deleted.

since parameter

since parameter can be used to return only objects that were changed since the provided timestamp. Each endpoint has a different since parameter, which is obtained when making a GET request to the list endpoint.

GET https://api.toshl.com/entries
HTTP/1.1 200 OK
Toshl-Modified: 2014-02-07 21:11:13.925

Note: If you want the sync to work correctly, do not set your own since parameter - always use the one provided by the sever.

Toshl-Modified header value is saved and sent with the next request to the same endpoint. Just make sure to URL encode it before your send it.

GET https://api.toshl.com/entries?since=2014-02-07+21%3A11%3A13.925

include_deleted parameter

Setting include_deleted to true makes sure the returned list includes deleted objects. All deleted objects will have their deleted parameter set to true and you can safely delete them from your local storage.

GET https://api.toshl.com/entries?include_deleted=true