[ckan-dev] API Representation Registry

Friedrich Lindenberg friedrich.lindenberg at okfn.org
Fri Jun 3 09:51:22 UTC 2011


Hi David,

On Fri, Jun 3, 2011 at 11:38 AM, David Read <david.read at okfn.org> wrote:
> I'm pretty lost on the meaning this ticket. Are you talking about a
> mapping between the way we store metadata in our model and a way we
> can send/receive it over the API and or Web UI?

I'm in turn not sure what you mean by that but I think yes: its about
mapping expected mime types to methods for the creations of object
representations in these types. Example:

The request
   GET /api/rest/package/foo HTTP/1.1 \n Accept: application/json \n
Host: ckan.net
would look up g.representation_registry[('application/json', Package)]
be returned a function like: to_json(obj, mime_type)
and then return the output generated by this.

> Also, what's this alternative routing hack you mentioned?

https://bitbucket.org/okfn/ckanext-pdeu/src/d35bfe5e16f5/ckanext/pdeu/controllers.py

... In which we would get to implement lookup, error handling and
authorization a third time. (In the current implementation breaking
support for groups etc. btw)

- Friedrich




More information about the ckan-dev mailing list