Getting all open or overdue invoices

Hi,

I am trying to get all open or overdue invoices from FreeAgent and to my
knowledge this was working fine. I then realised that a recently raised
invoice was missing from the resulting array, I suspected it was my own
code but after a little digging and outputting the raw response from
FreeAgent API I can see this is not the case.

I am making a simple GET request to FA using the following URL *
https://api.freeagent.com/v2/invoices/?view=open_or_overdue*

FreeAgent is then coming back with an array of open or overdue invoices but
it is missing this particular invoice. Just to make sure it was open or
overdue I applied the filter ?view=open_or_overdue to the front end of the
website and the invoice displays without a problem. Please help!

Chris.

OK, having looking into this issue further (as it’s become a serious block
right now for our project) I have been able to determine that it is
returning all open and overdue invoices until our invoice reference changes
to 20XX

As I mentioned before, all of these invoice (inc ones with 20XX reference)
are returned when we make the call on the front end interface but not via
the API. Any ideas??

Hi Donal,

Thanks for clarifying this, it’s now working perfectly - may I suggest that this is documented in every section where pagination occurs? As when I read the v2 introduction, it was some time back and I haven’t looked since!

Chris.

Hi Chris,

By default the API will limit the number of items per page to 25.

If you are getting 25 invoices, then to access the remaining invoices, you
can:

a) Increase the number of invoices returned per page by adding &per_page=X
to the url where X has a maximum of 100
b) Ask for subsequent pages by adding &page=X to the url

You can read more about this at FreeAgent Developer Dashboard.

Regards,
Donal McBreenOn Monday, February 25, 2013 10:08:39 AM UTC, Chris wrote:

OK, having looking into this issue further (as it’s become a serious block
right now for our project) I have been able to determine that it is
returning all open and overdue invoices until our invoice reference changes
to 20XX

As I mentioned before, all of these invoice (inc ones with 20XX reference)
are returned when we make the call on the front end interface but not via
the API. Any ideas??