[ckan-discuss] REST API Error Messages

Friedrich Lindenberg friedrich at pudo.org
Thu Jul 29 14:46:32 BST 2010


Hi John,

I just saw your notice on http://okfnpad.org/ckan regarding API error
messages. The task was inspired by Glen Barnes' recent troubles in
getting a ruby client to talk to CKAN via the REST API.

What I would like to change here is three things:
a) Wrap some of the controller actions in a try/catch and return the
exception message along with 500 server errors to give clients a clue
as to what is wrong.
b) Add extensive logging on the server, including stack traces.
c) Wrap any error messages returned by the server in a JSON
dictionary. This makes recognizing them easier for clients
(essentially, I can still json.loads() them and then check if they
have an 'error' key) and it allows client to output a more meaningful
message. It is a bit redundant, though, given that we also return a >=
400 status code.

What's your opinion on these changes? Would they be useful? And: would
you consider (c) to break the API 1 contract (and have this moved into
v2)?

Regards,

 Friedrich



More information about the ckan-discuss mailing list