Ask, reply and learn. Join the community of Akaunting.
Hello,
I'm struggeling to get the API working when trying to add new invoices.
I've searched the web, read the threads in this forum and looked into the Akaunting code regarding API usage – still all I get from the API is a "The given data failed to pass validation" message.And with this being all information I get, I really don't know anymore if I'm missing some required fields, they have the wrong value or if I'm POST'ing in the wrong format (json, form-data, …) or anything else.
Has anybody a snipped of working code (in whatever programming language) for adding a new invoice?
I'd be happy to create a MR for improving the API docs if I ever figured this out.
Best regards
Flo
I'm offering $20 via Paypal for anybody who can give me a working code snipped that adds an invoice with items via the Akaunting API.
I found a solution and I'm therefore retracting my offer.
A correct JSON payload would be:
---
{
"customer_id": 1,
"customer_name": "Name",
"currency_code": "EUR",
"currency_rate": 1,
"invoiced_at": "2019-05-10 12:00:00",
"due_at": "2019-05-10 12:00:00",
"invoice_number": "20190099",
"order_number": null,
"notes": null,
"category_id": 1,
"recurring_frequency": "no",
"recurring_custom_frequency": "monthly",
"recurring_interval": 1,
"recurring_count": 0,
"invoice_status_code": "draft",
"amount": 10.0
}
---
For me the important part was the correct date format (with time!). I found this out by adding debug code to the Laraval FormRequest.php validation handler which gave me detailed validation messages instead of the generic "The given data failed to pass validation" message.
Showing 1 to 3 of 3 discussions