Forum Discussion

neilrogers1's avatar
3 years ago

how to delete a supplierpayment via the api

Hi

I am trying to delete a SupplierPayment via the API.

I am using ?$filter=UID eq guid'f9116384-6192-49c6-bda9-xxxxxxxxx' to get the payment and the record exists.

I then issue a DELETE verb using the same filter and I get a status response 404 record not found the url is 
/Purchase/SupplierPayment?returnBody=true&$filter=UID%20eq%20guid%27xxxxxxxx-xxxxxxxx%27

  • Will_H's avatar
    Will_H
    MYOB Moderator

    Hi neilrogers1 ,

     

    Forgive me if I get this wrong and someone has to correct me.  While I work for MYOB I'm from a different area of the business.

     

    If you look at the API documentation for the endpoint:

    https://developer.myob.com/api/myob-business-api/v2/purchase/supplierpayment/

     

    You can retrieve a Payment using the formula you suggest, however part of the response is the "URI" for the individual payment.

     

    In your case this would look like:

    /Purchase/SupplierPayment/f9116384-6192-49c6-bda9-xxxxxxxxx

     

    You would then need to send the DELETE request directly to that URI endpoint.  

     

    There's also a full Postman collection with examples for the AccountRight API you can find here:

    https://accountrightapi.myob.cloud/#fb7216b7-0c12-481a-bdd0-9764f4be3f55

     

     

    Note: You can't really say "Hey, retrieve me the body" in a DELETE command, so that's likely part of why the call is failing.

     

    Hope this helped, if it didn't, please reply asking for extra information and I'll leave it up to the regular API support team/other developers to get back to you.