Parameter encoding on GET /lenders/:lender_id/loans

34 views
Skip to first unread message

MPKeefe

unread,
Mar 7, 2013, 10:36:49 AM3/7/13
to build...@googlegroups.com
One of my users reported receiving a 400 error, when my app performs a GET /lenders/:lender_id/loans

The error states that lender_id is incorrectly formed. The lender ID contains a period character. I've never had to encode lender IDs in the past, but its possibles haven't. Hit this situation before. Entering the same URL in the browser produces the same error.

Do I need to start encoding lender ID? Will the server be happy in this example?

Here is a bit more logging:

Sent URL: http://api.kivaws.org/v1/lenders/t.dherck/loans.json?page=1&app_id=com.maynebridge.kivabridge
Received status code: 400
Received status message: HTTP/1.0 400 Bad Request
Received headers: {
"Access-Control-Allow-Headers" = Authorization;
"Access-Control-Allow-Methods" = "POST, GET, OPTIONS";
"Access-Control-Allow-Origin" = "*";
"Access-Control-Max-Age" = 1000;
Connection = "keep-alive";
"Content-Length" = 116;
"Content-Type" = "application/json; charset=UTF-8";
Date = "Thu, 07 Mar 2013 14:50:33 GMT";
Server = Apache;
}
didUseCachedResponse: NO
Received string: { "code" : "org.kiva.MalformedParameter"
, "message" : "The value for \u201clender_id\u201d is improperly formed." }

Martin Butt

unread,
Mar 8, 2013, 5:14:32 PM3/8/13
to build...@googlegroups.com
This will be fixed in the next build



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





--

Martin Butt | Software Engineer

Kiva – Loans that Change Lives
Join us on Twitter
Facebook and LinkedIn!

Martin Butt

unread,
Mar 11, 2013, 8:37:02 PM3/11/13
to build...@googlegroups.com
Hi Mark,

One of the engineers here did a bit more digging and it looks like that is a invalid lender ID, i.e. it doesn't exist in the database. Did you get it via an OAuth request, or did the user enter it manually?

Cheers,
    Martin

MPKeefe

unread,
Mar 14, 2013, 7:50:29 AM3/14/13
to build...@googlegroups.com
When I received the error report from the user a few days ago, I suggested he reset his lender ID without the "." as a workaround to the problem while it was being investigated by Kiva. This is likely why it no longer exists in the database. So I think the question remains whether the API is entirely consistent with lender ID creation rules.

Martin Butt

unread,
Mar 14, 2013, 10:57:47 AM3/14/13
to build...@googlegroups.com
The validation for both is the same, it has to be alphanumeric. There are no cases of periods in lender ids in our entire database. I've tested the validation and it works. I really think this must have been user error. You can safely validate the lender id in your app with the rules: "3 to 24 characters long and consist of only letters and numbers."


On 14 March 2013 04:50, MPKeefe <mpk...@gmail.com> wrote:
When I received the error report from the user a few days ago, I suggested he reset his lender ID without the "." as a workaround to the problem while it was being investigated by Kiva.   This is likely why it no longer exists in the database.   So I think the question remains whether the API is entirely consistent with lender ID creation rules.
--
You received this message because you are subscribed to the Google Groups "build-kiva" group.
To unsubscribe from this group and stop receiving emails from it, send an email to build-kiva+...@googlegroups.com.
To post to this group, send email to build...@googlegroups.com.
Visit this group at http://groups.google.com/group/build-kiva?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply all
Reply to author
Forward
0 new messages