Invoices - why no invoice_lines?

Hi there

I’m trying to get a list of invoices, using

GET https://api.freeagent.com/v2/invoices

This is fine, and I get a list of invoices, but none of them have invoice lines.

To get the invoice lines it appears I need to

GET https://api.freeagent.com/v2/invoices/123

which is going to uber slow if a user has, say, 100 invoices and are
on a 3G connection (thats 101 HTTP setup/request/teardown cycles…)

Is there a nice flag on the first GET to say “… and give me the
lines, too, please!”

Thanks

Nic

Nic Wise
t. +44 7788 592 806 | @fastchicken | http://www.linkedin.com/in/nicwise
b. http://www.fastchicken.co.nz/

Earnest: Self-employed? Track your business expenses and income.


Nearest Bus: find when the next bus is coming to your stop. http://goo.gl/Vcz1p
mobileAgent (for FreeAgent): get your accounts in your pocket.
http://goo.gl/IuBU
Trip Wallet: Keep track of your budget on the go: http://goo.gl/ePhKa
London Bike App: Find the nearest Boris Bike, and get riding! http://goo.gl/Icp2

Well, my use case - an otherwise offline client - is one of them, I think.

The cost of 100+1 https connections - just the connection, no data
transfer - would be orders of magnitude more than the (compressed?)
size of the extra data coming down.

Basically, unless I change how the app is expected to work (which is a
possibility), I need all of that info down before I can finish a sync.

Any chance of a url parameter being added to get them all in one? Or
the reverse: just give me a list of invoice numbers (urls), and I’ll
get the bodies on each call…On Sun, Jul 1, 2012 at 8:32 PM, Olly H olly@freeagent.com wrote:

Hi Nic

The idea here was to reduce the size of the response. If you had, as you
say, 100 invoices, returning their invoice items as well would dramatically
increase the amount of data sent between device and server.

We didn’t consider this an “n+1” problem (as you suggest) since we couldn’t
think of a use case for someone wanting line item details when returning a
list of invoices. We imagined only when you viewed a single invoice would
you need the line item details.

Olly

On Sunday, July 1, 2012 7:56:05 PM UTC+1, Nic Wise wrote:

Hi there

I’m trying to get a list of invoices, using

GET https://api.freeagent.com/v2/invoices

This is fine, and I get a list of invoices, but none of them have invoice
lines.

To get the invoice lines it appears I need to

GET https://api.freeagent.com/v2/invoices/123

which is going to uber slow if a user has, say, 100 invoices and are
on a 3G connection (thats 101 HTTP setup/request/teardown cycles…)

Is there a nice flag on the first GET to say “… and give me the
lines, too, please!”

Thanks

Nic


Nic Wise
t. +44 7788 592 806 | @fastchicken | http://www.linkedin.com/in/nicwise
b. http://www.fastchicken.co.nz/

Earnest: Self-employed? Track your business expenses and income.
http://earnestapp.com
Nearest Bus: find when the next bus is coming to your stop.
http://goo.gl/Vcz1p
mobileAgent (for FreeAgent): get your accounts in your pocket.
http://goo.gl/IuBU
Trip Wallet: Keep track of your budget on the go: http://goo.gl/ePhKa
London Bike App: Find the nearest Boris Bike, and get riding!
http://goo.gl/Icp2


You received this message because you are subscribed to the Google Groups
“FreeAgent API” group.
To view this discussion on the web visit
https://groups.google.com/d/msg/freeagent_api/-/Id5Z3X-Lyd8J.
To post to this group, send email to freeagent_api@googlegroups.com.
To unsubscribe from this group, send email to
freeagent_api+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/freeagent_api?hl=en.

Nic Wise
t. +44 7788 592 806 | @fastchicken | http://www.linkedin.com/in/nicwise
b. http://www.fastchicken.co.nz/

Earnest: Self-employed? Track your business expenses and income.


Nearest Bus: find when the next bus is coming to your stop. http://goo.gl/Vcz1p
mobileAgent (for FreeAgent): get your accounts in your pocket.
http://goo.gl/IuBU
Trip Wallet: Keep track of your budget on the go: http://goo.gl/ePhKa
London Bike App: Find the nearest Boris Bike, and get riding! http://goo.gl/Icp2

Wicked, thanks.

Philip Roberts
phil@latentflip.com
@philip_robertsOn Monday, 30 July 2012 at 13:15, Graeme Boyd wrote:

Hi Phil,

I added a flag to retrieve nested invoice items:

https://dev.freeagent.com/docs/invoices#list-all-invoices-with-nested-invoice-items

Kind regards,

Graeme

On 30 July 2012 12:24, Philip Roberts <phil@latentflip.com (mailto:phil@latentflip.com)> wrote:

Hey Olly,

Just wondered what the outcome of this was, if any?

Thanks,
Phil

On Sunday, July 1, 2012 8:40:37 PM UTC+1, Olly H wrote:

Hi Phil

Yeah, we’ll chat about this tomorrow.

Sorry for the trouble.

Olly

On Sunday, July 1, 2012 8:37:12 PM UTC+1, Philip Roberts wrote:

Oh, this doesn’t work? I was going to start trying to use the line items
soon too.

Our reason is wanting to tie up amounts on open invoices to accounting
categories, since it’s line items that are categorized rather than the
invoices themselves.

Olly, would an option be to allow them to be included, but reduce the
maximum items that can be returned per page?

Thanks,
Phil


You received this message because you are subscribed to the Google Groups
“FreeAgent API” group.
To view this discussion on the web visit
https://groups.google.com/d/msg/freeagent_api/-/cmihGfKR3MEJ.

To post to this group, send email to freeagent_api@googlegroups.com (mailto:freeagent_api@googlegroups.com).
To unsubscribe from this group, send email to
freeagent_api+unsubscribe@googlegroups.com (mailto:freeagent_api+unsubscribe@googlegroups.com).
For more options, visit this group at
http://groups.google.com/group/freeagent_api?hl=en.


Graeme Boyd
Senior Software Engineer

Web. freeagent.com (http://freeagent.com) Blog. freeagent.com/blog (http://freeagent.com/blog)
Twitter. @freeagent Facebook. facebook.com/freeagentapp (http://facebook.com/freeagentapp)

40 Torphichen Street, Edinburgh, EH3 8JB
FreeAgent Central Ltd. Registered in sunny Scotland SC316774


You received this message because you are subscribed to the Google Groups “FreeAgent API” group.
To post to this group, send email to freeagent_api@googlegroups.com (mailto:freeagent_api@googlegroups.com).
To unsubscribe from this group, send email to freeagent_api+unsubscribe@googlegroups.com (mailto:freeagent_api+unsubscribe@googlegroups.com).
For more options, visit this group at http://groups.google.com/group/freeagent_api?hl=en.

Hi Nic

The idea here was to reduce the size of the response. If you had, as you
say, 100 invoices, returning their invoice items as well would dramatically
increase the amount of data sent between device and server.

We didn’t consider this an “n+1” problem (as you suggest) since we couldn’t
think of a use case for someone wanting line item details when returning a
list of invoices. We imagined only when you viewed a single invoice would
you need the line item details.

OllyOn Sunday, July 1, 2012 7:56:05 PM UTC+1, Nic Wise wrote:

Hi there

I’m trying to get a list of invoices, using

GET https://api.freeagent.com/v2/invoices

This is fine, and I get a list of invoices, but none of them have invoice
lines.

To get the invoice lines it appears I need to

GET https://api.freeagent.com/v2/invoices/123

which is going to uber slow if a user has, say, 100 invoices and are
on a 3G connection (thats 101 HTTP setup/request/teardown cycles…)

Is there a nice flag on the first GET to say “… and give me the
lines, too, please!”

Thanks

Nic


Nic Wise
t. +44 7788 592 806 | @fastchicken | http://www.linkedin.com/in/nicwise
b. http://www.fastchicken.co.nz/

Earnest: Self-employed? Track your business expenses and income.
http://earnestapp.com
Nearest Bus: find when the next bus is coming to your stop.
http://goo.gl/Vcz1p
mobileAgent (for FreeAgent): get your accounts in your pocket.
http://goo.gl/IuBU
Trip Wallet: Keep track of your budget on the go: http://goo.gl/ePhKa
London Bike App: Find the nearest Boris Bike, and get riding!
http://goo.gl/Icp2

The cost of 100+1 https connections - just the connection, no data
transfer - would be orders of magnitude more than the (compressed?)
size of the extra data coming down.

Sure, I’m just wondering why you need the invoice item data for an invoice
list view? What are you doing with that info?

Any chance of a url parameter being added to get them all in one? Or
the reverse: just give me a list of invoice numbers (urls), and I’ll
get the bodies on each call…

We’ll get a solution for you, let us have a chat tomorrow

Hi Phil,

I added a flag to retrieve nested invoice items:

https://dev.freeagent.com/docs/invoices#list-all-invoices-with-nested-invoice-items

Kind regards,

GraemeOn 30 July 2012 12:24, Philip Roberts phil@latentflip.com wrote:

Hey Olly,

Just wondered what the outcome of this was, if any?

Thanks,
Phil

On Sunday, July 1, 2012 8:40:37 PM UTC+1, Olly H wrote:

Hi Phil

Yeah, we’ll chat about this tomorrow.

Sorry for the trouble.

Olly

On Sunday, July 1, 2012 8:37:12 PM UTC+1, Philip Roberts wrote:

Oh, this doesn’t work? I was going to start trying to use the line items
soon too.

Our reason is wanting to tie up amounts on open invoices to accounting
categories, since it’s line items that are categorized rather than the
invoices themselves.

Olly, would an option be to allow them to be included, but reduce the
maximum items that can be returned per page?

Thanks,
Phil


You received this message because you are subscribed to the Google Groups
“FreeAgent API” group.
To view this discussion on the web visit
https://groups.google.com/d/msg/freeagent_api/-/cmihGfKR3MEJ.

To post to this group, send email to freeagent_api@googlegroups.com.
To unsubscribe from this group, send email to
freeagent_api+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/freeagent_api?hl=en.

Graeme Boyd
Senior Software Engineer

Web. freeagent.com Blog. freeagent.com/blog
Twitter. @freeagent Facebook. facebook.com/freeagentapp

40 Torphichen Street, Edinburgh, EH3 8JB
FreeAgent Central Ltd. Registered in sunny Scotland SC316774

Hi Phil

Yeah, we’ll chat about this tomorrow.

Sorry for the trouble.

OllyOn Sunday, July 1, 2012 8:37:12 PM UTC+1, Philip Roberts wrote:

Oh, this doesn’t work? I was going to start trying to use the line items
soon too.

Our reason is wanting to tie up amounts on open invoices to accounting
categories, since it’s line items that are categorized rather than the
invoices themselves.

Olly, would an option be to allow them to be included, but reduce the
maximum items that can be returned per page?

Thanks,
Phil

Oh, this doesn’t work? I was going to start trying to use the line items
soon too.

Our reason is wanting to tie up amounts on open invoices to accounting
categories, since it’s line items that are categorized rather than the
invoices themselves.

Olly, would an option be to allow them to be included, but reduce the
maximum items that can be returned per page?

Thanks,
PhilOn Jul 1, 2012 8:32 PM, “Olly H” olly@freeagent.com wrote:

Hi Nic

The idea here was to reduce the size of the response. If you had, as you
say, 100 invoices, returning their invoice items as well would dramatically
increase the amount of data sent between device and server.

We didn’t consider this an “n+1” problem (as you suggest) since we
couldn’t think of a use case for someone wanting line item details when
returning a list of invoices. We imagined only when you viewed a single
invoice would you need the line item details.

Olly

On Sunday, July 1, 2012 7:56:05 PM UTC+1, Nic Wise wrote:

Hi there

I’m trying to get a list of invoices, using

GET https://api.freeagent.com/v2/**invoiceshttps://api.freeagent.com/v2/invoices

This is fine, and I get a list of invoices, but none of them have invoice
lines.

To get the invoice lines it appears I need to

GET https://api.freeagent.com/v2/**invoices/123https://api.freeagent.com/v2/invoices/123

which is going to uber slow if a user has, say, 100 invoices and are
on a 3G connection (thats 101 HTTP setup/request/teardown cycles…)

Is there a nice flag on the first GET to say “… and give me the
lines, too, please!”

Thanks

Nic


Nic Wise
t. +44 7788 592 806 | @fastchicken | http://www.linkedin.com/in/**
nicwise http://www.linkedin.com/in/nicwise
b. http://www.fastchicken.co.nz/

Earnest: Self-employed? Track your business expenses and income.
http://earnestapp.com
Nearest Bus: find when the next bus is coming to your stop.
http://goo.gl/Vcz1p
mobileAgent (for FreeAgent): get your accounts in your pocket.
http://goo.gl/IuBU
Trip Wallet: Keep track of your budget on the go: http://goo.gl/ePhKa
London Bike App: Find the nearest Boris Bike, and get riding!
http://goo.gl/Icp2


You received this message because you are subscribed to the Google Groups
“FreeAgent API” group.
To view this discussion on the web visit
https://groups.google.com/d/msg/freeagent_api/-/Id5Z3X-Lyd8J.
To post to this group, send email to freeagent_api@googlegroups.com.
To unsubscribe from this group, send email to
freeagent_api+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/freeagent_api?hl=en.

Sure, I’m just wondering why you need the invoice item data for an invoice
list view? What are you doing with that info?

In mobileagent at the moment, I show a list of invoices, and you tap
the invoice, and it shows the invoice details, including lines. Normal
master/detail type view.

All of this is offline - there is no network calls when the user does
this, as I assume that, unless they are syncing, it’s 100% offline.
The only time I call the FA api is when they sync, or upload (or
login)

I suspect, at the moment, I’m doing N+1 calls anyway, so this may not
be a big issue. (just checked: no, I’m not - it all comes down in one
call at the moment, with v1 API)

We’ll get a solution for you, let us have a chat tomorrow

Sounds good to me.

Nic Wise
t. +44 7788 592 806 | @fastchicken | http://www.linkedin.com/in/nicwise
b. http://www.fastchicken.co.nz/

Earnest: Self-employed? Track your business expenses and income.


Nearest Bus: find when the next bus is coming to your stop. http://goo.gl/Vcz1p
mobileAgent (for FreeAgent): get your accounts in your pocket.
http://goo.gl/IuBU
Trip Wallet: Keep track of your budget on the go: http://goo.gl/ePhKa
London Bike App: Find the nearest Boris Bike, and get riding! http://goo.gl/Icp2