[ckan-dev] Package Create API

Mike Sinclair mm.sinclair08 at gmail.com
Thu Feb 4 06:14:41 UTC 2016


Thanks - this is the format that worked - it seems name works as long as
you refer to the *name* and not the *title* like I did....

{
  "name": "test13",
  "title": "Test 13",
  "description": "something here",
  "owner_org": "test",
  "notes": "notes",
   "groups": [
    {"name":"transportation"}
  ]
}


Thank you,

Mike


ᐧ

On Wed, Feb 3, 2016 at 2:57 AM, Pedro G Silva <pedro.gracio at deimos.com.pt>
wrote:

> Sample code for ckanapi in python: (I never managed to get it to work
> using the name field, only with the id). Also if you package_create passing
> the groups and then make a package_update without passing the groups, the
> dataset loses its groups (*dunno if this is intended or an issue*)
>
> group = ckan.action.group_show(id='data-from-multiparametric-buoys')
> group_list=[{"id":group['id']}]
>
> #group_list=[{"name":"Data from multiparametric buoys"}]
>
> vocabs = ckan.action.package_update(id=pkg.get('id'), tags=[{"name":
> "IH","name": "Monican01"}],extras=extras_dict,groups=group_list )
>
> On Wed, Feb 3, 2016 at 7:57 AM, Matthew Fullerton <
> matt.fullerton at gmail.com> wrote:
>
>> Hi Mike,
>> I think it goes like this:
>> {
>>   "packagekey": "packagekeyvalue",
>>   "etc": "etcvalue",
>>   "groups":
>>     [
>>       {"id": "id_of_group_1"},
>>       {"name": "name_of_group_2"}
>>     ]
>> }
>>
>> But don't hold your breath that identifying groups by name will work, I
>> would say its safer to use id.
>>
>> Best,
>> Matt
>>
>> On 3 February 2016 at 08:40, Mike Sinclair <mm.sinclair08 at gmail.com>
>> wrote:
>>
>>> Hi guys,
>>>
>>> I'm a bit confused. One of the parameters for package_create is:
>>>
>>> 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),
>>> or 'name' (the name of the group, string), to see which groups exist call
>>> group_list()
>>>
>>> If I do the a package_create, I am dumping this json into a python dict.
>>> Are the groups supposed to be in a nested dictionary? Is so, is the dict
>>> called "group"? What are the name, value pairs?
>>>
>>> Thanks,
>>>
>>> Mike
>>>>>>
>>> _______________________________________________
>>> ckan-dev mailing list
>>> ckan-dev at lists.okfn.org
>>> https://lists.okfn.org/mailman/listinfo/ckan-dev
>>> Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
>>>
>>>
>>
>> _______________________________________________
>> ckan-dev mailing list
>> ckan-dev at lists.okfn.org
>> https://lists.okfn.org/mailman/listinfo/ckan-dev
>> Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
>>
>>
>
>
> --
>
>
> [image: DEIMOS Engenharia, SA] <http://www.deimos.pt>
> *Pedro Gracio Silva*
> Aerospace Systems / Production Center
>
> *Av. D. Joao II, Lt 1.17.01, 10 • 1998-023 Lisboa, Portugal*
> Ph: +351 21 893 3020 • Fax: +351 21 896 9099
>
>
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> https://lists.okfn.org/mailman/listinfo/ckan-dev
> Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20160203/49b3ae85/attachment-0003.html>


More information about the ckan-dev mailing list