How to do an overnight sync
Problem / Solution
Problem: You're using webhooks to update your own system, but you'd like to be double-sure your docs are all synced properly.
Solution: A document query you can run every night that returns everything that happened since the previous night.
How to
Simply add 'modified_gt=' to the /api/v1/document query.
e.g. Get up to 500 documents modified since a previous datetime (without signer details).
/api/v1/document/?group=your-group&nosigners=1&limit=500&modified_gt=[datetime of last query]
/api/v1/document/?group=your-group&nosigners=1&limit=500&offset=500&modified_gt=[datetime of last query]
This query includes the parameter nosigners=1
. If you don't need signer status information (you may only need document status) this will make your query much faster. Speed things up still further by using a large limit
value. (Go to document status reference).
The offset
parameter iterates the list. But easily iterate your documents by getting the next URL to query from the 'next' item within a response's 'meta' object. When the next value is null there are no more items to get.
Example response including 'meta':
{
"meta": {
"limit": 20,
"next": "/api/v1/document/?limit=20&offset=40&group=xxxx",
"offset": 20,
"previous": "/api/v1/document/?limit=20&offset=0&group=xxxx",
"total_count": 192
},
"objects": [
{
"archived": false,