Creating/updating a primary bank account

I recently attempted to create a new primary bank account (with is_primary=true) via the API, but the is_primary flag is ignored. Unsurprisingly, trying to update the resource with is_primary=true also does nothing, but it does return a 200 response code which is somewhat confusing. Is there a reason this is not currently supported?

Request:

POST /bank_accounts
{
  "bank_account": {
    "opening_balance": "0.0",
    "type": "StandardBankAccount",
    "name": "New Primary Bank Account",
    "is_personal": false,
    "is_primary": true,
    "currency": "GBP",
    "bank_code": "generic",
    "account_number": "123456789",
    "sort_code": "000000"
  }
}

Response:

{
  "bank_account": {
    "url": "https://api.sandbox.freeagent.com/v2/bank_accounts/2196",
    "opening_balance": "0.0",
    "type": "StandardBankAccount",
    "name": "New Primary Bank Account",
    "is_personal": false,
    "is_primary": false,
    "currency": "GBP",
    "current_balance": "0.0",
    "account_number": "123456789",
    "sort_code": "000000",
    "bank_code": "generic",
    "latest_activity_date": "2016-01-01",
    "updated_at": "2017-02-01T13:21:44.032Z",
    "created_at": "2017-02-01T13:21:44.032Z",
    "unexplained_transaction_count": 0,
    "marked_for_review_count": 0,
    "bank_feed_enabled": false,
    "bank_guess_enabled": false
  }
}

Hi Dylan,

The is_primary attribute is read only at the minute (sorry, this isn’t clear in our documentation). Having said that we can look at adding a method to set the primary bank account, but it’ll not be tomorrow - we have a backlog of work that we need to work through first.

The reason you’re getting a 200 response on a PUT request therefore is that is_primary is filtered out of the request parameters before attempting the update. Other values are persisted, therefore a successful status is returned.

There are a couple of things for us to tackle there to make the API more predictable in its use. I’ll take these to our API backlog and update you here as and when we have any news for you.

Cheers,
Paul

Thanks for the quick response Paul.