Closed alexbogias closed 3 years ago
OK just found it! I used: NinjaConfig::setPerPage(9999);
The sendRequest function uses pagination even when using function all. You could use NinjaConfig::setPerPage(100);
Hi, I think something is wrong about the ::all() method. You cannot simply use setPerPage option as in the API code there is a MAX_API_PAGE_SIZE constant which is 500. Here's the line of code So using NinjaConfig::setPerPage(9999); will not bring you more than 500 records.
I guess this was added as a precaution, but how are we supposed to paginate the results trough the API, as the sdk does not provide us back the meta data like current page, total pages?
If I look directly at the response the application returns this meta data is included, but they get lost in the sendRequest method.
This method needs some refactoring as currently I don't see how we could get all of the results from an endpoint.
It looks like we'd need to expose the pagination through the SDK
At the API docs page under optional settings, it lists the page parameter. So I guess it only needs a minor adjustment in the sdk sendRequest function: https://github.com/invoiceninja/sdk-php/blob/master/src/InvoiceNinja/Models/AbstractModel.php#L153
Maybe there should be an options parameter (array) for the sendRequest function, that is merged with the other options?
That sounds about right..
Why when trying to grab all expenses the array that returns always gives 15 values?
$expenses = Expense::all();