I’m trying to add an expense to invoice via API.
Since I couldn’t find any documentation, I tried to read the code but I suck at php.
I came across this however: https://github.com/invoiceninja/invoiceninja/blob/v4.5.49/app/Http/Controllers/ExpenseController.php#L193
if (in_array($action, ['archive', 'delete', 'restore', 'invoice', 'add_to_invoice'])) {
return self::bulk();
}
if I do a PUT request like this
curl -X "PUT" "https://app.invoiceninja.com/api/v1/expenses/1?action=archive"
It archives the expense as expected, so I thought I was in luck and tried action=add_to_invoice and passed in the invoice ID in the body like this:
-d $'{
"invoice_id": "92"
}'
but unfortunately I get the message Action [add_to_invoice] is not supported
what am I doing wrong?