customers/get
I'm trying to build a nice CG IOS app with Sencha touch &
Phonegap! I want to scratch my own itch and help make CG even
better. But, I'm running into a problem with the API.
customers/get
, when I call it on my own CG account,
takes like 43 seconds to finish and is 4.6mb in size. Perhaps I'm
missing something but is there a way to get a lean version of an
account customer list? You know without every single invoice and
subscription elements that repeat themselves over and over?
If not, I can still use customers/get as like a client side model with localStorage and have users just periodically update the store. But, again, the time it takes to grab the data when it's not in your query cache is 43 seconds? I'm thinking if 43 seconds is how long it takes on my account with 180 customers how long does it take on someone with 1000 customers?
In your defense I realize that your API get's interacted with
mostly by applications that already have a list of their clients so
they can iterate over their clients and make single calls with
code/
.
Question two. If you don't have a way to do this currently, how
soon do you think you could optimize customers/get
or
add a lean version sort of like your updates separated by
subscription or client info?
Thanks!
-Stephen Rhyne @srhyne
Discussions are closed to public comments.
If you need help with Cheddar please
start a new discussion.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
Support Staff 1 Posted by Marc Guyer on 17 Mar, 2011 02:54 PM
Hi Stephen -- That issue has been on our list for a while. We haven't yet come up with a good solution that maintains backward compatibility. In hindsight, customers/get should only return the current subscription and current invoice. Unfortunately it returns a full history for each customer. I'm pretty sure we will need to break BC at some point because the current behavior is unusable. That will take an orchestrated effort including communication with existing users and a time delay.
In the short term, we might consider creating a new secret call just for you...
2 Posted by Stephen Rhyne on 19 Mar, 2011 06:49 PM
Hi Marc,
Thanks for getting back to me. Perhaps you could setup your
/customers/
controller like you do your/edit/
controller. You have edit, edit-customer, and edit-subscription. So you could have perhapscustomers/get/
to return all info like you are now andcustomers/get-customer/
for just customer info?I'd be super happy to get this resource as I really want to build this app.
Thanks Marc. Be well!
-Stephen Rhyne @srhyne
Support Staff 3 Posted by Marc Guyer on 23 Mar, 2011 01:10 PM
Hi Stephen -- We're working on something for you. Stay tuned!
Support Staff 4 Posted by Marc Guyer on 23 Mar, 2011 04:20 PM
Hi again -- Our devs were able to get this out quicker than I thought...
There is a new api method:
/customers/list
. The available parameters are basically the same ascustomers/get
but there is no orderBy.You can try it out now but it is subject to change. Consider it in beta. Some rough stats:
Sample set of 500 customers with up to 5 months of history.
The list method is basically the same as the get method on the surface. The xml format is very similar. The major difference is less information and no history. In other words, only current subscription and current invoice is returned. No tracked item information, current charges, etc. What's included is essentially basic information about the customer, the current subscription and the current invoice.
Please let us know if you have questions or suggestions.
5 Posted by Stephen Rhyne on 23 Mar, 2011 09:40 PM
Marc,
Thank you so much for this update! Very impressed with how quickly you were able to get this done. I'm looking forward to using it!
-Stephen
6 Posted by Stephen Rhyne on 03 Apr, 2011 06:14 PM
I'm getting an XML error on customers/list
`error on line 32 at column 19: Opening and ending tag mismatch:
createdDatetime line 0 and subscription`
Just an FYI. Thanks for the awesome API call. Waaaay faster.
Support Staff 7 Posted by Marc Guyer on 05 Apr, 2011 01:44 PM
Thanks for the bug report. We'll have a fix deployed today.
8 Posted by David on 10 Apr, 2011 02:19 AM
Marc.
I'm using the customers/list api now also... its much faster... Thanks
Can you add current information for the customers cc_Type; cc_LastFour; cc_ExpirationDate; cc_zip
This would help me provide current payment info to my customers with this new api.
9 Posted by David on 10 Apr, 2011 04:16 AM
Never mind my last post... I think I figured it out...
10 Posted by Stephen Rhyne on 05 Apr, 2012 11:44 PM
I would love to see transactionDate start/end limiters on on
customers/get1
. I've been using the call but it's quite slow. Probably because the call is like 11mb! haha. I think that if I could limit the amount of transactions to just a year or month that would really cut down the weight.Thanks!
Support Staff 11 Posted by Marc Guyer on 06 Apr, 2012 03:10 PM
We're going to need to make some changes to the
customers/get
call because it is so inefficient. We'll probably add some limitations like a max number returned with paging. Also, we'll likely reduce the amount of history for individual accounts. This is all theoretical.I'd like to understand your use-case so I can better help you with this particular situation. What is it you're trying to accomplish?
12 Posted by Stephen Rhyne on 06 Apr, 2012 04:13 PM
Well, last week I had to create a revenue report that listed each one of my WA state customer's total revenue for 2011. So here's how I had to do it.
I first started by trying to do it all cross-domain from file:// in Safari then just use jQuery as an element selector on the
customers/get
xml. However, that crashed Safari due to the 11mb I got back ;)Plan B
customers/get
into a local customers.xml fileThere's so much awesome data in there that could be summarized. Considering creating a reporting app using slim.php connected to the
customers.xml
file.13 Posted by Alex on 02 Jun, 2012 11:11 AM
Hello.
Any progress?
Am I to correctly understand that
customers/get/product/-/code/-
will list every single invoice in the customer's history without limit?We are planning to make >a lot< of calls, and the prospect of getting back a huge XML document back every time is causing some concern.
We need detailed invoice information very regularly (i.e every day) (dates, paid, item counts), but only for outstanding or pending invoices. Is there some kind of parameter available to limit the list to these? Even better would be being able to specify what data to retrieve in the request.
Additionally, tracked items. We have like 5 (very volatile) tracked items at the moment, and this could easily grow to 20+ in the future. Imagine 1000 customers with 20 tracked items, that would make 20k HTTP calls per 24hrs purely to update usage. I'm fairly sure at this point CG would become unfeasible.
Any advice or news regarding any of this?
Support Staff 14 Posted by Marc Guyer on 03 Jun, 2012 12:27 AM
That is regretfully correct.
We've discussed several options but haven't decided on anything yet. Ideally, we'd like to fix this for everyone already using the call. In the end, we may have to deprecate the current functionality and introduce some default filters (paging, limited history, items on/off, etc).
There is an undocumented call:
customers/list
which is much faster and returns limited information (pending invoice only). Usage is the same ascustomers/get
. Does that help for the time being?15 Posted by Alex on 03 Jun, 2012 12:40 AM
I read the rest of this thread and tried out
list
but unfortunately it doesn't give enough information for our purposes (for example, we bring the billing date forward when a customer exceeds a threshold on current invoice charges).In any case, explicit filters would certainly be a benefit if they were added.
(
setItemQuantities
too, but that's another API issue altogether).Support Staff 16 Posted by Marc Guyer on 04 Jun, 2012 12:52 PM
Hmm... I guess I'm not following you here. Can you explain this in more detail?
17 Posted by Alex on 04 Jun, 2012 01:09 PM
Sure.
We don't want our customers to go over a certain amount of charges at one time, as we're exposed to lose it all due to their ability to cancel their PayPal agreement.
To counteract this, we sum their overages (by iterating through items on the
customer/get
call), and if the total is over an amount we bring forward the billing date tonow
.I was just observing that
customers/list
does not provide information about overages, so we're forced to use get.Hope that clears it up!
Dean closed this discussion on 23 Jan, 2013 01:48 PM.