Xero SDK - A validation exception occurred, DELETE method cannot be used on Bank accounts

65 views Asked by At

I am trying to delete account or updating account using xero api. Api is giving me exception with status code like 400

A validation exception occurred, DELETE method cannot be used on Bank accounts.

Attached is the code.

//deleting account using unique id
    xeroClient.deleteAccount("XXXXX-XxxxX-Xxxx-XXXX-XXXXXXX");

//setting deleted status via update()
Account account=new Account();

account.setAccountID("XXXXX-XxxxX-Xxxx-XXXX-XXXXXXX");

account.setStatus(AccountStatus.DELETED);

updateList.add(account);

xeroClient.updateAccount(updateList);

May I know why the exception I am getting while deleting account via Xero API

1

There are 1 answers

0
Dave B On

According to the Xero Documentation;

Accounts of type 'BANK' cannot be updated

It would appear that you have to do it manually through the web interface.