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

George Sattler George.sattler at xvt.com.au
Wed Nov 19 23:26:42 UTC 2014


Hi Matt
From looking at the code I would say that there’s actually no provision for being able to use ‘title’ As per https://github.com/ckan/ckan/blob/master/ckan/lib/dictization/model_save.py package_membership_list_save() … So I think, yes - it’s in the docs, but no - it doesn’t work.

I think raising an issue on github would be the way to go.

George

On 20 Nov 2014, at 12:05 am, Matt Fullerton <matt.fullerton at okfn.de<mailto:matt.fullerton at okfn.de>> wrote:

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
_______________________________________________
ckan-dev mailing list
ckan-dev at lists.okfn.org<mailto:ckan-dev at lists.okfn.org>
https://lists.okfn.org/mailman/listinfo/ckan-dev
Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev


________________________________
This email and any files transmitted with it is confidential and intended solely for the use of the addressee. The unauthorised use, dissemination, forwarding, printing or copying of this communication is strictly prohibited. If you have received this communication in error please notify us immediately by reply email and destroy this communication. Any views and opinions presented in this email are solely those of the author and do not necessarily represent the views of XVT Solutions. The recipient should check this email and any attachments for viruses. XVT Solutions accepts no liability for the content of this email, and any damage caused by any viruses that could potentially be transmitted through this email.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20141120/446dd9ae/attachment-0003.html>


More information about the ckan-dev mailing list