Reputation: 1748
I am integrating the Xero Accounting API with some software for a client and need to get all PAID invoices between two specified dates.
I am using XeroOauth-PHP as my API wrapper, but can't understand how I get results for between two dates. I have read the Xero API Docs but they don't say how get results between two dates.
From looking at how Xero itself does it (see below screenshot), they add a 'startDate' and 'endDate' as query parameters
I have tried this but without any changed to the results return from the query:
$xeroPayments = simplexml_load_string($this->xero->request('GET', $this->xero->url('Invoices'), ['startDate' => '2015-06-01', 'endDate' => '2015-07-01', 'Where' => 'Status=="PAID"'], '', 'xml');
Is there someone that may be able to point me in the right direction?
Upvotes: 3
Views: 2515
Reputation: 1748
I ended up contacting the Xero Support Team in regards to this one. So for anyone else that comes across this question, here is the syntax for search an endpoint between two dates:
$invoices = simplexml_load_string($this->xero->request('GET', $this->xero->url('Invoices'), ['Where' => 'Type == "ACCREC" AND Date > DateTime.Parse("2015-06-01T00:00:00") and Date < DateTime.Parse("2015-07-01T00:00:00")'], '', 'xml'));
I would assume this is the same other endpoints and not just Invoices.
Upvotes: 4