Xero - beautiful accounting software

Xero Developer Help Center

Xero Developer Community

Community > API Endpoints >

Profit and Loss prior periods incorrect

Started by Alan Uhe -   in API Endpoints

As per the documentation, calling the Profit and Loss endpoint in Reports should display 'whole month' prior periods regardless of how many days in the current month. At the moment, it is returning all prior months at 30th of each month. This should only occur if the fromDate and toDate parameters are supplied, which they are not.The Balance Sheet endpoint exhibits the expected behaviour.
If you use the periods parameter in combination with the fromDate and toDate parameters then the specified date range will apply to each period (i.e. if the specified date range is for a 30 day month, each prior period will only include the first 30 days).

To ensure you always get a full month of data in previous periods either:
- Start from current month (i.e. don't specifiy a fromDate or toDate on the request), or
- Start in a month with 31 days (e.g. start in July instead of June)

Adam Moore (Community Manager)  

Hi Adam, as above, fromDate and toDate were not supplied on the request.

Alan Uhe