Forum Discussion

dkarzon-pinch's avatar
3 months ago

How to handle deleted invoices through the API

We have a system that syncs invoices from MYOB to allow payment on them. However, we have an issue where if an invoice is deleted within MYOB the API acts as if it never existed so searching for the invoice or getting invoices by a specific Customer does not return the invoice if it has been deleted.

Is there a way through the API to detect if an invoice was deleted in MYOB (either by the invoice Id or the number)? Any way other than checking for a 404 response on the API call for each individual invoice?

  • The_Doc's avatar
    The_Doc
    Ultimate Cover User

    Hi dkarzon-pinch 

    Have a look at the pointer from Mike_James - however, I have developed an app for a client that has now taken over backorders in their MYOB system - and invoices get added and deleted all the time especially SOrders.

     

    And I also delete them from my app.

     

    Each invoice has a URI - as does each SO - however, in my initial build of my app I struck this problem and built a copy in my app of all invoices in myob - and cross checked this everytime I updated - and produced an error code if an invoice had vanished - I think this is your simplest way - invoice id are not unique enough but uri are and are only accessible via the API.

     

    My system works ( actually if I get a duplication of an invoice/SO number it causes a problem but that is by design - not as a fault) - but for the MYOB API to delete an invoice or SO it is very easy - it just needs the uri - which for duplicate invoice numbers or SOs are unique.

     

    Hope this helps but it is a relatively easy solution to code.

    The Doc

     

  • Isaiah_C's avatar
    Isaiah_C
    MYOB Moderator

    Hi dkarzon-pinch,

     

    Hopefully, another developer in the community will be able to provide you with a solution soon. In the meantime, if you need further assistance, please reach out to the support team at developer.myob.com.

     

    Regards,

    Sai