MYOB AccountRight is a concurrent use platform. This means at any one time multiple users or applications may be reading or writing to the same database at the same time.
To work with this AccountRight makes use of a RowVersion tag to ensure that nothing has changed since the data was requested.
RowVersion is a required item on any PUT request - that is any update to existing data.
I am getting IncorrectRowVersion errors
Let's pretend you are updating the prices for some items in the AccountRight file. Your application has fetched a full list of items by GETting the {{api_uri}}/{{company_file_id}}/Inventory/Item or you might have fetched data of a specific item by GETting the {{api_uri}}/{{company_file_id}}/Inventory/Item/{{item_id}} endpoints.
Now you have a payload and contained within this you will find a RowVersion, it's usually the last item in the json.
{ .... "RowVersion": "-6933843581174022144" }
NOTE: if you are updating an invoice you will notice a RowVersion for each line, as well as the entire invoice
Using the RowVersion tag
Whenever you are PUTting data to the AccountRight API you will need to include the RowVersion. Make sure this is the same RowVersion that was given to you when you retrieved the data during a GET request.
IncorrectRowVersion
If you get this error it means the data has changed between the time you made your GET request and the time you made the PUT request. Now you have to fetch the fresh data (a new GET request), check the data to see what changed and prompt the user to decide if they want to merge the data or give them a chance to review and make their change again.
It doesn't actually happen all that often - however you need to be prepared for when it does happen.
Comments
0 comments
Please sign in to leave a comment.