[GeoNode-devel] Customizing the results of the /api/maps API endpoint?
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
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
> 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)
> 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...
More information about the geonode-devel