Ask, reply and learn. Join the community of Akaunting.
Hi there,
I'm trying to add an Invoice by the API. Same way as I successfull tried to add Customers/Vendors etc. But by this Invoice I get a 500 Error in Postman:
===
{
"message": "The given data failed to pass validation.",
"status_code": 500,
"debug": {
"line": 125,
===
What I send to: "http://akaunting:8888/api/invoices"
is:
{
"company_id": 1,
"invoice_number": "INV-00002",
"order_number": null,
"invoice_status_code": "paid",
"invoiced_at": "2018-08-23T17:03:44+00:00",
"due_at": "2018-08-30T17:03:44+00:00",
"amount": 121,
"currency_code": "EUR",
"currency_rate": 1,
"customer_id": 1,
"customer_name": "My Name",
"customer_email": "[email protected]",
"customer_tax_number": "FR12345678",
"customer_phone": "+3361123456",
"customer_address": "The Address",
"category_id": 3,
"parent_id": 0,
"notes": null,
"item":[
{
"item_id": null,
"name": "Invoice 104002",
"sku": "",
"quantity": 1,
"price": 100,
"total": 100,
"tax": 21,
"tax_id": 3
}
]
}
What am I doing wrong?
Jerry, what is you Akaunting version?
Hi Denis, tried with "develop" (github) version and with 1.2.12 Stable.
Jerry, can you please open the storage/logs/laravel.log file and see the full error message?
Also, can you please be sure that EUR currency is enabled?
Log file stays empty (nothing added), but complete response from API:
{
"message": "The given data failed to pass validation.",
"status_code": 500,
"debug": {
"line": 125,
"file": "/Users/jerry/Documents/sites_mamp/akaunting/vendor/laravel/framework/src/Illuminate/Foundation/Http/FormRequest.php",
"class": "Illuminate\\Validation\\ValidationException",
"trace": [
"#0 /Users/jerry/Documents/sites_mamp/akaunting/vendor/laravel/framework/src/Illuminate/Validation/ValidatesWhenResolvedTrait.php(24): Illuminate\\Foundation\\Http\\FormRequest->failedValidation(Object(Illuminate\\Validation\\Validator))",
"#1 /Users/jerry/Documents/sites_mamp/akaunting/vendor/laravel/framework/src/Illuminate/Foundation/Providers/FormRequestServiceProvider.php(31): Illuminate\\Foundation\\Http\\FormRequest->validate()",
"#2 /Users/jerry/Documents/sites_mamp/akaunting/vendor/laravel/framework/src/Illuminate/Container/Container.php(1019): Illuminate\\Foundation\\Providers\\FormRequestServiceProvider->Illuminate\\Foundation\\Providers\\{closure}(Object(App\\Http\\Requests\\Income\\Invoice), Object(Illuminate\\Foundation\\Application))",
"#3 /Users/jerry/Documents/sites_mamp/akaunting/vendor/laravel/framework/src/Illuminate/Container/Container.php(984): Illuminate\\Container\\Container->fireCallbackArray(Object(App\\Http\\Requests\\Income\\Invoice), Array)",
"#4 /Users/jerry/Documents/sites_mamp/akaunting/vendor/laravel/framework/src/Illuminate/Container/Container.php(968): Illuminate\\Container\\Container->fireAfterResolvingCallbacks('App\\\\Http\\\\Reques...', Object(App\\Http\\Requests\\Income\\Invoice))",
"#5 /Users/jerry/Documents/sites_mamp/akaunting/vendor/laravel/framework/src/Illuminate/Container/Container.php(627): Illuminate\\Container\\Container->fireResolvingCallbacks('App\\\\Http\\\\Reques...', Object(App\\Http\\Requests\\Income\\Invoice))",
"#6 /Users/jerry/Documents/sites_mamp/akaunting/vendor/laravel/framework/src/Illuminate/Container/Container.php(575): Illuminate\\Container\\Container->resolve('App\\\\Http\\\\Reques...')",
"#7 /Users/jerry/Documents/sites_mamp/akaunting/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(728): Illuminate\\Container\\Container->make('App\\\\Http\\\\Reques...')",
"#8 /Users/jerry/Documents/sites_mamp/akaunting/vendor/laravel/framework/src/Illuminate/Routing/RouteDependencyResolverTrait.php(77): Illuminate\\Foundation\\Application->make('App\\\\Http\\\\Reques...')",
"#9 /Users/jerry/Documents/sites_mamp/akaunting/vendor/laravel/framework/src/Illuminate/Routing/RouteDependencyResolverTrait.php(47): Illuminate\\Routing\\ControllerDispatcher->transformDependency(Object(ReflectionParameter), Array)",
"#10 /Users/jerry/Documents/sites_mamp/akaunting/vendor/laravel/framework/src/Illuminate/Routing/RouteDependencyResolverTrait.php(28): Illuminate\\Routing\\ControllerDispatcher->resolveMethodDependencies(Array, Object(ReflectionMethod))",
"#11 /Users/jerry/Documents/sites_mamp/akaunting/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(41): Illuminate\\Routing\\ControllerDispatcher->resolveClassMethodDependencies(Array, Object(App\\Http\\Controllers\\Api\\Incomes\\Invoices), 'store')",
"#12 /Users/jerry/Documents/sites_mamp/akaunting/vendor/laravel/framework/src/Illuminate/Routing/Route.php(204): Illuminate\\Routing\\ControllerDispatcher->dispatch(Object(Illuminate\\Routing\\Route), Object(App\\Http\\Controllers\\Api\\Incomes\\Invoices), 'store')",
"#13 /Users/jerry/Documents/sites_mamp/akaunting/vendor/laravel/framework/src/Illuminate/Routing/Route.php(160): Illuminate\\Routing\\Route->runController()",
"#14 /Users/jerry/Documents/sites_mamp/akaunting/vendor/laravel/framework/src/Illuminate/Routing/Router.php(572): Illuminate\\Routing\\Route->run()",
"#15 /Users/jerry/Documents/sites_mamp/akaunting/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\\Routing\\Router->Illuminate\\Routing\\{closure}(Object(Dingo\\Api\\Http\\Request))",
"#16 /Users/jerry/Documents/sites_mamp/akaunting/vendor/santigarcor/laratrust/src/Laratrust/Middleware/LaratrustPermission.php(56): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Dingo\\Api\\Http\\Request))",
"#17 /Users/jerry/Documents/sites_mamp/akaunting/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Laratrust\\Middleware\\LaratrustPermission->handle(Object(Dingo\\Api\\Http\\Request), Object(Closure), 'create-incomes-...')",
"#18 /Users/jerry/Documents/sites_mamp/akaunting/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Dingo\\Api\\Http\\Request))",
"#19 /Users/jerry/Documents/sites_mamp/akaunting/app/Http/Middleware/LoadCurrencies.php(27): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Dingo\\Api\\Http\\Request))",
"#20 /Users/jerry/Documents/sites_mamp/akaunting/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): App\\Http\\Middleware\\LoadCurrencies->handle(Object(Dingo\\Api\\Http\\Request), Object(Closure))",
"#21 /Users/jerry/Documents/sites_mamp/akaunting/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Dingo\\Api\\Http\\Request))",
"#22 /Users/jerry/Documents/sites_mamp/akaunting/app/Http/Middleware/LoadSettings.php(27): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Dingo\\Api\\Http\\Request))",
"#23 /Users/jerry/Documents/sites_mamp/akaunting/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): App\\Http\\Middleware\\LoadSettings->handle(Object(Dingo\\Api\\Http\\Request), Object(Closure))",
"#24 /Users/jerry/Documents/sites_mamp/akaunting/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Dingo\\Api\\Http\\Request))",
"#25 /Users/jerry/Documents/sites_mamp/akaunting/vendor/santigarcor/laratrust/src/Laratrust/Middleware/LaratrustPermission.php(56): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Dingo\\Api\\Http\\Request))",
"#26 /Users/jerry/Documents/sites_mamp/akaunting/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Laratrust\\Middleware\\LaratrustPermission->handle(Object(Dingo\\Api\\Http\\Request), Object(Closure), 'read-api')",
"#27 /Users/jerry/Documents/sites_mamp/akaunting/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Dingo\\Api\\Http\\Request))",
"#28 /Users/jerry/Documents/sites_mamp/akaunting/app/Http/Middleware/ApiCompany.php(37): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Dingo\\Api\\Http\\Request))",
"#29 /Users/jerry/Documents/sites_mamp/akaunting/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): App\\Http\\Middleware\\ApiCompany->handle(Object(Dingo\\Api\\Http\\Request), Object(Closure))",
"#30 /Users/jerry/Documents/sites_mamp/akaunting/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Dingo\\Api\\Http\\Request))",
"#31 /Users/jerry/Documents/sites_mamp/akaunting/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php(41): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Dingo\\Api\\Http\\Request))",
"#32 /Users/jerry/Documents/sites_mamp/akaunting/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\\Routing\\Middleware\\SubstituteBindings->handle(Object(Dingo\\Api\\Http\\Request), Object(Closure))",
"#33 /Users/jerry/Documents/sites_mamp/akaunting/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Dingo\\Api\\Http\\Request))",
"#34 /Users/jerry/Documents/sites_mamp/akaunting/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequests.php(49): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Dingo\\Api\\Http\\Request))",
"#35 /Users/jerry/Documents/sites_mamp/akaunting/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\\Routing\\Middleware\\ThrottleRequests->handle(Object(Dingo\\Api\\Http\\Request), Object(Closure), '60', '1')",
"#36 /Users/jerry/Documents/sites_mamp/akaunting/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Dingo\\Api\\Http\\Request))",
"#37 /Users/jerry/Documents/sites_mamp/akaunting/vendor/dingo/api/src/Http/Middleware/Auth.php(55): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Dingo\\Api\\Http\\Request))",
"#38 /Users/jerry/Documents/sites_mamp/akaunting/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Dingo\\Api\\Http\\Middleware\\Auth->handle(Object(Dingo\\Api\\Http\\Request), Object(Closure))",
"#39 /Users/jerry/Documents/sites_mamp/akaunting/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Dingo\\Api\\Http\\Request))",
"#40 /Users/jerry/Documents/sites_mamp/akaunting/vendor/dingo/api/src/Http/Middleware/PrepareController.php(45): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Dingo\\Api\\Http\\Request))",
"#41 /Users/jerry/Documents/sites_mamp/akaunting/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Dingo\\Api\\Http\\Middleware\\PrepareController->handle(Object(Dingo\\Api\\Http\\Request), Object(Closure))",
"#42 /Users/jerry/Documents/sites_mamp/akaunting/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Dingo\\Api\\Http\\Request))",
"#43 /Users/jerry/Documents/sites_mamp/akaunting/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Dingo\\Api\\Http\\Request))",
"#44 /Users/jerry/Documents/sites_mamp/akaunting/vendor/laravel/framework/src/Illuminate/Routing/Router.php(574): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))",
"#45 /Users/jerry/Documents/sites_mamp/akaunting/vendor/laravel/framework/src/Illuminate/Routing/Router.php(533): Illuminate\\Routing\\Router->runRouteWithinStack(Object(Illuminate\\Routing\\Route), Object(Dingo\\Api\\Http\\Request))",
"#46 /Users/jerry/Documents/sites_mamp/akaunting/vendor/laravel/framework/src/Illuminate/Routing/Router.php(511): Illuminate\\Routing\\Router->dispatchToRoute(Object(Dingo\\Api\\Http\\Request))",
"#47 /Users/jerry/Documents/sites_mamp/akaunting/vendor/dingo/api/src/Routing/Adapter/Laravel.php(81): Illuminate\\Routing\\Router->dispatch(Object(Dingo\\Api\\Http\\Request))",
"#48 /Users/jerry/Documents/sites_mamp/akaunting/vendor/dingo/api/src/Routing/Router.php(513): Dingo\\Api\\Routing\\Adapter\\Laravel->dispatch(Object(Dingo\\Api\\Http\\Request), 'v1')",
"#49 /Users/jerry/Documents/sites_mamp/akaunting/vendor/dingo/api/src/Http/Middleware/Request.php(126): Dingo\\Api\\Routing\\Router->dispatch(Object(Dingo\\Api\\Http\\Request))",
"#50 /Users/jerry/Documents/sites_mamp/akaunting/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(114): Dingo\\Api\\Http\\Middleware\\Request->Dingo\\Api\\Http\\Middleware\\{closure}(Object(Dingo\\Api\\Http\\Request))",
"#51 /Users/jerry/Documents/sites_mamp/akaunting/vendor/fideloper/proxy/src/TrustProxies.php(56): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Dingo\\Api\\Http\\Request))",
"#52 /Users/jerry/Documents/sites_mamp/akaunting/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Fideloper\\Proxy\\TrustProxies->handle(Object(Dingo\\Api\\Http\\Request), Object(Closure))",
"#53 /Users/jerry/Documents/sites_mamp/akaunting/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(30): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Dingo\\Api\\Http\\Request))",
"#54 /Users/jerry/Documents/sites_mamp/akaunting/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Dingo\\Api\\Http\\Request), Object(Closure))",
"#55 /Users/jerry/Documents/sites_mamp/akaunting/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(30): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Dingo\\Api\\Http\\Request))",
"#56 /Users/jerry/Documents/sites_mamp/akaunting/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Dingo\\Api\\Http\\Request), Object(Closure))",
"#57 /Users/jerry/Documents/sites_mamp/akaunting/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Dingo\\Api\\Http\\Request))",
"#58 /Users/jerry/Documents/sites_mamp/akaunting/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize->handle(Object(Dingo\\Api\\Http\\Request), Object(Closure))",
"#59 /Users/jerry/Documents/sites_mamp/akaunting/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(46): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Dingo\\Api\\Http\\Request))",
"#60 /Users/jerry/Documents/sites_mamp/akaunting/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\\Foundation\\Http\\Middleware\\CheckForMaintenanceMode->handle(Object(Dingo\\Api\\Http\\Request), Object(Closure))",
"#61 /Users/jerry/Documents/sites_mamp/akaunting/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Dingo\\Api\\Http\\Request))",
"#62 /Users/jerry/Documents/sites_mamp/akaunting/vendor/dingo/api/src/Http/Middleware/Request.php(127): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))",
"#63 /Users/jerry/Documents/sites_mamp/akaunting/vendor/dingo/api/src/Http/Middleware/Request.php(103): Dingo\\Api\\Http\\Middleware\\Request->sendRequestThroughRouter(Object(Dingo\\Api\\Http\\Request))",
"#64 /Users/jerry/Documents/sites_mamp/akaunting/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Dingo\\Api\\Http\\Middleware\\Request->handle(Object(Illuminate\\Http\\Request), Object(Closure))",
"#65 /Users/jerry/Documents/sites_mamp/akaunting/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))",
"#66 /Users/jerry/Documents/sites_mamp/akaunting/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))",
"#67 /Users/jerry/Documents/sites_mamp/akaunting/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(151): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))",
"#68 /Users/jerry/Documents/sites_mamp/akaunting/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(116): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter(Object(Illuminate\\Http\\Request))",
"#69 /Users/jerry/Documents/sites_mamp/akaunting/index.php(28): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))",
"#70 {main}"
]
}
}
EUR is the only currency availible. Code is EUR.
Try changing date format like this
"invoiced_at": "2018-08-23 03:44:00",
"due_at": "2018-08-30 03:44:00",
Thanks Benod for your reply!
I tried it like this, but get the same error. Input:
{
"company_id":1,
"invoice_number":"INV-00002",
"order_number":"",
"invoice_status_code":"paid",
"invoiced_at":"2018-08-23 03:44:00",
"due_at":"2018-08-30 03:44:00",
"amount":121,
"currency_code":"EUR",
"customer_id":1,
"category_id":3,
"parent_id":0,
"notes":"",
"item":[
{
"item_id":null,
"name":"Invoice 104002",
"sku":"",
"quantity":1,
"price":100,
"total":100,
"tax":21,
"tax_id":3
}
]
}
I have the same problem exactly, any idea about what happening??
No, still not working. Moved Akaunting away! ;-)
Has been impossible updates a company, I don't know what akaunting API wants of me....
Showing 1 to 10 of 14 discussions