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

Simone Dalmasso simone.dalmasso at gmail.com
Thu Aug 25 23:37:29 PDT 2016

You are right, we have deactivated any dehydrate process on any of the
resource base apis in order to keep them fast.

You could create you own maps API endpoint though and have the map list to
use it.

Il giovedì 25 agosto 2016, Craig Stephenson <crstephenson at alaska.edu> ha

> 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
> endpoint:
> /api/maps
> 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!
> Craig

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geonode-devel/attachments/20160826/349a6868/attachment.html>

More information about the geonode-devel mailing list