Unfortunately, I keep getting an internal server error (500). I checked the Invoice Ninja Server logs and this was the output:
[2021-03-17 12:27:16] production.ERROR: array_key_exists() expects parameter 2 to be array, string given {"userId":1,"exception":"[object] (ErrorException(code: 0): array_key_exists() expects parameter 2 to be array, string given at /var/www/app/app/Http/Requests/Request.php:131)
[stacktrace]
#0 [internal function]: Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError()
#1 /var/www/app/app/Http/Requests/Request.php(131): array_key_exists()
#2 /var/www/app/app/Http/Requests/Client/StoreClientRequest.php(86): App\\Http\\Requests\\Request->decodePrimaryKeys()
Would appreciate any assistance in fixing this? Or perhaps an example script that can allow me to add a Client to Invoice Ninja via the API? Thank you.
Thanks David,
The API docs have been extremely helpful and everything is running smoothly except for one minor issue. I am trying to pass the country_id field to set the country for the client. I am passing the country code using the code below:
$clientData = [
...
'country_id' => 'UG',
]
I notice the API docs state that the field is string and this worked in v4 where it would correctly set the country as per the passed code. However, in v5, I get the response below:
{
"message": "The given data was invalid.",
"errors": {
"country_id": [
"The country id must be an integer."
]
}
}
My question is, what number is used to identify the different countries. It would also be much cleaner and easier to add a country_iso_code field instead of country_id? Thanks!