How to update the type of a bank transaction explanation


#1

Hello FreeAgent API forum!

I would like to update the type of a bank transaction explanation. The docs don’t go into enough detail unfortunately. For example: an explanation has a type of “Payment” with a category of 280 and I want to update it with PUT to an explanation with a type of “Money paid to user”, a category of 907 and (an additional field for this type) a paid user of 706069. If I try this:

PUT https://api.freeagent.com/v2/bank_transaction_explanations/167295407
{
    "bank_transaction_explanation": {
        "category": "https://api.freeagent.com/v2/categories/907",
        "is_money_paid_to_user": true,
        "paid_user": "https://api.freeagent.com/v2/users/706069"
    }
}

I get the following response:

400 Bad Request
{
    "errors": {
        "error": {
            "message": "unknown attribute 'category' for BankAccountEntry."
        }
}

}

Confusing! I have a large batch of these to update, so any help would be much appreciated.

Thanks.


#2

Hi Ben,

Apologies, the error message is indeed misleading. It looks like the underlying cause is the missing gross_value parameter. The following request should work:

PUT https://api.freeagent.com/v2/bank_transaction_explanations/167295407
{
   "bank_transaction_explanation" : {
      "gross_value" : [AMOUNT]
      "category" : "https://api.freeagent.com/v2/categories/907",
      "paid_user" : "https://api.freeagent.com/v2/users/706069"
   }
}

Thanks,

Anup