Updating Invoice Line Items via API

Does anybody has a working sample or curl request, showing how to update invoice line items ?
I seem to get an internal server error, every time I try to update an existing line item via API

Can you show us your current Curl request?

In order to update an invoice_item, you need to send the entire invoice object along with the invoice_items as child objects.

https://app.invoiceninja.com/api-docs

I created an invoice and line items, using the following payload. (<id> was not added during insert.)
Now trying to update the same using PUT

{
“client_id” : 1,
“invoice_date” : “2017-04-07”,
“invoice_items” : [ {
“id”: 3,
“product_key” : “Fees”,
“qty” : 1.00,
“cost” : 19.00
}, {
“id”: 4,
“product_key” : “Services”,
“qty” : 2.00,
“cost” : 199.00
} ]
}

We don’t support setting invoice line item ids, when an invoice is updated we recreate the line items. We’re looking into changing this in the future.

What link are you using, it should be /api/v1/invoices/<invoice_id>. Also, are there details about the error in storage/logs/laravel-error.log

I am receiving errors, even if I remove the ids.
Yes, I am using /api/v1/invoices/<InvoiceId>

How can I access error logs ?
I am currently on the Trial Plan

Thanks, I think I see the problem.

Try adding a ‘notes’ property to each line item.

Amazing !!! Works :slight_smile:

Nice, great to hear!

We’ll look into making the field optional…

Long shot but do you by chance have the code that you used to this? I’m attempting to do the same thing but having significant troubles.