[ckan-dev] API: Specifying groups by title for adding datasets doesn't work(?)

Matt Fullerton matt.fullerton at okfn.de
Wed Nov 19 13:05:30 UTC 2014


I am adding datasets with the API and trying to specify groups by their
titles.

Here a partial output of /api/3/action/group_list?all_fields=True
{
help: "Return a list of the names of the site's groups. :param order_by:
the field to sort the list by,
...
{
...
display_name: "Gesundheit",
description: "",
title: "Gesundheit",
package_count: 0,
...
name: "gesundheit"
},
...

When I make the following data post to /api/3/action/package_create
{"name": "df63df60-32ec-45ea-8116-8ee372ed95a8", "groups": [{"title":
"Gesundheit"}], "title": ...}

The dataset gets added but with no groups assigned.

Even though the docs say:
groups (list of dictionaries) – the groups to which the dataset belongs
(optional), each group dictionary should have one or more of the following
keys which identify an existing group: 'id' (the id of the group, string),
'name' (the name of the group, string),* 'title' (the title of the group,
string),* to see which groups exist call group_list()

Am I missing something? Its not mission-critical for me, I can transform
the group titles into their names, which works.

Thanks,
Matt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20141119/e9c4133b/attachment-0002.html>


More information about the ckan-dev mailing list