[GeoNode-devel] Customizing the results of the /api/maps API endpoint?

Craig Stephenson crstephenson at alaska.edu
Thu Aug 25 13:40:57 PDT 2016

Hi All,

I'm working on a project that uses GeoNode's API system. I've already had
some success adding/modifying existing endpoints, but I've hit a snag. I'm
hoping somebody can help point me in the right direction.

I want to include each map's keywords in the results of the following API


I've found that the API results for a specific map (e.g., /api/maps/3) can
be customized by adding a dehydrate function to the MapResource class in
the geonode/api/resourcebase_api.py file. For example, the keyword list can
be added to the results like this:

class MapResource(CommonModelApi):
    def dehydrate(self, bundle):
        map_id = bundle.data['id']
        mapObj = Map.objects.filter(id=map_id)[0]
        bundle.data['keyword_list'] = mapObj.keyword_list()
        return bundle

But this dehydrate function does not get invoked when you access the entire
map list at /api/maps. How can I add data to the results for each map on
the /api/maps endpoint?

Thank you!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geonode-devel/attachments/20160825/a9b4a4a3/attachment.html>

More information about the geonode-devel mailing list