Xero - beautiful accounting software

Xero Developer Help Center

Xero Developer Community

Community > API Endpoints >

Get Journals : Modified After vs. offset

Started by Xiaoyu Zhang -   in API Endpoints

Greetings !

I'm wondering when it to use `Modified After` ? when to use `offset` to get an incremental journals ?

https://developer.xero.com/documentation/api/accounting/journals#get-journals

I"m thinking of setup an incremental syncing process wondering which one should be best choice.

I'm wondering how user can `update` a posted journal ?
Is user only allowed to update a `mannual journal` ?
for journal other than `mannual journal` user can only reverse the orignal and post a new one to perfrom an `update` action . right ?
Whenever a transaction is created in Xero (Invoice, Payment, Manual Journal etc.) an accounting journal is posted (A). The accounting journals are generally permanent and are not updated.
When a transaction is updated in Xero we post two further accounting journals. The first (B) will reverse the original accounting journal, and the second (C) will record the newly revised figures. Journals A and B cancel each other out, leaving just C recording the transaction.

To use the accounting journals you would typically need to retrieve the entire set. The expectation is that your app would do this using the offset value and store the resulting journals and journal lines in a database. After an initial retrieval your app would perform subsequent updates using the if-modified-since header and the offset value.

You would always start with an offset of zero. You would then use the last journal number retrieved as the offset for the next call. During the initial retrieval your last journal is likely to be 100, so this would be your next offset. During an update it will most likely not be 100, as we will return the first 100 journals that meet the "modified after" criteria, so if the last journal was number 14,234. This would be your next offset.
 

Robin B (Community Manager)