[ckan-dev] Updating group via API clears its packages

Sean Hammond sean.hammond at okfn.org
Mon Sep 17 09:48:00 UTC 2012


> Over at http://hub.healthdata.gov we're populating site data
> entirely through the API. I'm now creating groups. I found that when
> I update a group, any packages previously contained in the group are
> no longer associated with the group.
> 
> Is that the expected behavior?

That's the current behaviour, yes. I'm not sure whether it was
implemented that way for a reason. Personally I think it would be better
if, when updating a dataset via the API, if for example no 'groups' key
is passed with the dataset dict then the dataset's groups should not be
changed. Seems more intuitive and makes the API more convenient to use.
And your argument about not having to post thousands of packages in the
data for simple updates is good also.

Or if we're going to stick with the current behaviour we should
certainly explain it in the package_update docstring.

This goes for other updates as well, e.g. group_update, etc.

What do others think about this?

By the way, I recommend using v3 of the CKAN API as it's more complete
and (since CKAN 1.8) has a better docs:

http://docs.ckan.org/en/ckan-1.8/apiv3.html

P.S. We'll try to look at your GitHub pull request as soon as we can




More information about the ckan-dev mailing list