If you have ever tried Postman for interacting with WebAPI’s, following is a typical issue you would’ve faced.
When you try to update a record in Quickbooks sandbox using an Update statement you might’ve come across this Authentication error for the very first time.
“<Message>= Application Authentication failed; errorCode 003200; statusCode=401 </Message>”
Upon re-executing the same code, you could’ve come across the following error.
“You and XXX were working on this at the same time. XXX finished before you did, so your work was not saved.”
XXX is yourself, too.
This error is really frustrating and shows up several times. Your code would get successfully executed only once, upon trying many times. And, if you wish to update the same record, with different input, surprisingly, your immediate update request shall fail. You know that you’ve already cleared your cache and restarted your browser.
This is because of using the incorrect sync token. Make sure you input the proper sync token.
Keep in mind that the sync token is incremented whenever an update is made. You need to use the latest sync token.
For a successful update,
Fetch the correct sync token with an appropriate Read request using the select statement in the Post method.
Input the retrieved sync token in the body and make an Update request.
Send the Post method.
Update successful!
Previously, when your update was unsuccessful, it was because, fortunately, your input sync token has matched with the right sync token.
However, now, if you want to update the same record again, increment your sync token by one. You can check the current sync token by using the select statement . If you would like to update a different record get the right sync token and update.
Happy coding! 🙂