API- Unable to create bank transaction explanations for bill

Hi,

I am creating bank transaction explanations for Bill paid and continuously getting error message. Following is the request and response:
Request:

POST=> https://api.sandbox.freeagent.com/v2/bank_transaction_explanations

Raw Payload:

{"bank_transaction_explanations":
   {
    "bank_account": "https://api.sandbox.freeagent.com/v2/bank_accounts/2072",
    "dated_on": "2016-10-13",
    "paid_bill": "https://api.sandbox.freeagent.com/v2/bills/1271"
   }
}

Response:

{
"errors": {
    "error": {
                "message": "bank_transaction or bank_account required"
               }-
             } 
 }

Hi Hardeep,

Sorry to hear you’re having trouble with our API, I’m sure I can help.

Thanks for providing the payload in your query; I’ve been able to locate your requests in our logs.
I think the problem here is your outer hash is pluralised, bank_transaction_explanations

Changing this to the singular, bank_transaction_explanation should solve your problem.

I hope this helps!
Dave J

Hi David,

Thanks this solves my problems, But API documentation is very poor. Kindly update all required fields information in your api documentation and also provide full request payload in query response.

To make this work I have to add “description” and “gross_value” also into payload along with outer hash singular bank_transaction_explanation which are not required in documentation
Following payload works:

{"bank_transaction_explanation":
   {
    "bank_account": "https://api.sandbox.freeagent.com/v2/bank_accounts/2072",
    "dated_on": "2016-10-13",
    "paid_bill": "https://api.sandbox.freeagent.com/v2/bills/1271",
    "description": "test payment",
    "gross_value":"25"

   }
}

I hope this helps to others!
Hardeep Saggi