I looking to use the API (/api/v2/assets/) to regularly get the latest data. Ideally, I would also get a history of changes to the data, but I have not figured out a way to get previous (changed) submissions via the API.
I am using /api/v2/assets/{asset_uid}/data/ to get the latest data. I want to get only data that is new or changed since my last pull of data. I first tried to query by _submission_time, but it seems like this is not updated on edit. I found that I can use meta/deprecatedID to get any submissions that have been edited.
Thanks for the reply. I am able to find which records have been edited, but from what I can tell, I cannot get a history of the edits. I was hoping I could use the old _uuid values to get previous versions of edited submissions.
Hi @mattlangeman, unfortunately this isn’t available through the API and, as far as I know, we don’t store the history of individual submissions, only the form itself. @jnm will be able to correct/elaborate here.
But maybe you can work around it.
If you enforce a workflow where you use the new duplicate function before editing, you’ll have a history of all the edits.
If you have a primary key column in your data, you’ll be able to link them. Or else you can enter the previous _id in your edits to create a kind of linked list.
Having a complete history probably isn’t critical, but would be nice. If I’m pulling in data on a nightly basis, it would only miss changes if there are multiple in a day.
I decided to dig into the code a bit. It does look like the older submission is overwritten. However, a new InstanceHistory object is created with a copy of the old xml, old uuid, and link to Instance object. Guessing this history is not accessible via the API, but nice to know it is getting stored.