Skip to content

Add date filter options for voucherlist to reduce response size #82

@klein0r

Description

@klein0r

Missing options (optional):

  • voucherDateFrom
  • voucherDateTo
  • createdDateFrom
  • createdDateTo
  • updatedDateFrom
  • updatedDateTo

in

https://github.com/clicksports/lexoffice-php-api/blob/e22446f2d9a35f4f17f6574b14f1f435e8d1996b/src/Voucherlist/Client.php#L49-L55

Documentation: https://developers.lexoffice.io/docs/#voucherlist-endpoint-retrieve-and-filter-voucherlist

The reason for this issue is, that I have more than 10000 vouchers in my lexoffice account. When requesting all of them, I get

Fatal error: Uncaught GuzzleHttp\Exception\ServerException: Server error: `GET https://api.lexoffice.io/v1/voucherlist?page=100&size=100&sort=voucherNumber,DESC&voucherType=salesinvoice&voucherStatus=draft,open,paid,paidoff,voided,accepted,rejected` resulted in a `500 Internal Server Error` response:
 { "timestamp" : "2022-07-01T09:50:53.481+02:00", "status" : 500, "error" : "Internal Server Error", "path": "/v1/vouche (truncated...)
 in /lexoffice-scanner/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:113

I think this could be solved by reducing the result (I just need the last month).

Code:

$client = $api->voucherlist();
$client->sortDirection = 'DESC';
$client->sortColumn = 'voucherNumber';
$client->types = [
    'salesinvoice'
];
$client->statuses = [
    'draft',
    'open',
    'paid',
    'paidoff',
    'voided',
    'accepted',
    'rejected'
];

$response = $client->getAll();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions