MplusKASSA uses sync markers to keep track of updates on the entities. This is the documentation about the syncMarkers MplusKASSA provides:
A syncMarker will help you to create an efficient and fast synchronization process. They’re available for the following items:
- Products & Articles
Let’s imagine that you want to build an application that synchronizes all invoices from Mplus to another system. You could simply retrieve all invoices everytime you do a synchronization, but that will severely impact performance as more and more invoices are added to the system.
A smarter idea would be filtering invoices by date using the
throughFinancialDate parameters. But what if an invoice is changed in Mplus after you’ve already processed the date of that invoice? The best way to solve that problem and properly implement synchronization is using the
How the syncMarker works
syncMarker is a continuous sequence of integers that is raised by one everytime an item is changed, regardless of the initial creation date of the item. The
syncMarker is passed along as an additional parameter when the item is retrieved through the API. Each type of item listed above has their own sequence of integers.
You should save an internal value of the
syncMarker to use in your synchronization. When you perform synchronization for the first time, your internal
syncMarker should typically be set to a value of 1. That way you start from the beginning.
'invoiceId' => '09e2d578-b101-11e4-af90-12e3f512a338',
'syncMarker' => 1,
'invoiceId' => '1ce362aa-b101-11e4-af90-12e3f512a338',
'syncMarker' => 4,
'invoiceId' => '200f09b6-b101-11e4-af90-12e3f512a338
'syncMarker' => 3,
Because the highest value of
syncMarker in these results is 4, you save that value of 4 as your internal
When the next invoice is added or changed in Mplus, that invoice will get a
syncMarker value of 5. The next time you perform the synchronization, you use your own internal
syncMarker value of 4, you add 1 to that before you do the request, and you will only receive this next invoice in the results, because it has a
syncMarker value of 5.
This time around you save the value of 5 to your internal
syncMarker. Everytime you synchronize you repeat this process.