Loans search

37 views
Skip to first unread message

Vijay

unread,
Nov 24, 2012, 10:29:38 AM11/24/12
to build...@googlegroups.com
Hi,

I just have a few questions regarding loan methods.

  1. http://api.kivaws.org/v1/loans/search.json - it doesn't seem to return expired loans, when called with no parameters
    other than the page number.  Is this by design?
  2. Is there a way to get the largest loan ID? http://api.kivaws.org/v1/loans/newest.json seems to return loans by posted
    date, but it only returns fundraising loans, not all
  3. What is the recommended way to get the list of all loans posted in, say last 90 days? 
  4. It looks like the loan IDs are not strictly in ascending order with their posted dates - for example, loan ID 450,000 could
    have been posted later than loan ID 450,100.  Is this correct?

Thank you,

Vijay.

Noah Balmer

unread,
Nov 24, 2012, 11:42:26 AM11/24/12
to build...@googlegroups.com
Hi Vijay, 
  1. Yes, expired loans are intentionally not shown
  2. I don't know. Using loans/search with all statuses specified and sortby=newest will give you all new loans with any status, but there is no guarantee that the largest ID will be on the first page.    
  3. use search with orderby=newest
  4. IDs are created when loans are added by the field partner, but they are typically not posted immediately.  At minimum, they then have to be reviewed, and translated if they aren't in english.  Other factors, such as partner fund raising limits, can also delay the appearance of a given loan on the site.  I don't recommend treating the order of IDs as very meaningful information.  The IDs are just meant to be unique identifiers, the timestamps are better for figuring out meaningful order.
cheers,
-Noah

--
You received this message because you are subscribed to the Google Groups "build-kiva" group.
To post to this group, send email to build...@googlegroups.com.
To unsubscribe from this group, send email to build-kiva+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/build-kiva?hl=en.

Vijay

unread,
Nov 24, 2012, 12:03:06 PM11/24/12
to build...@googlegroups.com
Hi,

Thank you Noah, for the quick reply.

Since the loans/search doesn't return expired loans, it seems like the only way to get all
loans (including expired ones) is to use the loans/ids method, specifying the IDs?

I actually download all loans once a month (for the LLL team specifically), but that takes
a few hours and I'll have to make lots and lots of calls to the loans/ids method :(

Can I make the following requests?
  1. loans/search - please return all loans, including defaulted, expired, issue etc
  2. loans/search - could we add sort by id?
  3. loans/search doesn't give the borrower info, while loans/ids does.  could we add it to loans/search, please?
    good thing with loans/search is it returns 20 loans per page, where as loans/ids only returns 10, so it is half
    the number of calls.
Also, do you have plans to expose zip data via the API?

I hope I am not being a pain :(

It is possible to query the loans individually and maintain a database, it is just tedious.  It works well for fundraising loans
since there are only about 3000-4000 of them at a time (I actually query every 20 mins, to maintain this
page - http://kivatools.com/fundraising)

Thanks again Noah,
Vijay

Noah Balmer

unread,
Nov 24, 2012, 12:57:01 PM11/24/12
to build...@googlegroups.com
You could download the snapshots, populate your own DB, and order it by ID. Would that work for you?

We are deliberately not returning certain types of loans in search.  I can check in with some folks and make sure that's a policy we want to keep, but I don't think we're going to change it.

Vijay

unread,
Nov 24, 2012, 1:34:06 PM11/24/12
to build...@googlegroups.com
okay, but I think the data snapshots are more than 6 months old, correct?

Noah Balmer

unread,
Nov 25, 2012, 5:58:19 AM11/25/12
to build...@googlegroups.com
The snapshots are building every night.  They should be up to date.

Vijay

unread,
Nov 25, 2012, 7:50:57 AM11/25/12
to build...@googlegroups.com
Awesome, I didn't know that.  This is awesome, thank you.
Reply all
Reply to author
Forward
0 new messages