[ckan-dev] including organization in a package_create

Adrià Mercader adria.mercader at okfn.org
Tue Jun 11 11:51:24 UTC 2013


Hi,

Henrik is right, you need to use the "owner_org" param to define the
id of the organization.

This has been now documented [1] but for some reason the docs fail to
pick this change. We'll need to have a look at this.

Adrià

[1] https://github.com/okfn/ckan/blob/master/ckan/logic/action/create.py#L104

On 7 June 2013 08:12, Henrik Korsgaard <henrikkorsgaard at gmail.com> wrote:
> Hi Paul,
>
> I do not think the owning organisation is documented in the API, but the
> parameter is "owner_org". I have some javascript code using the parameter
> when I do a simple package create:
>
> function package_create(base_ckan_url, apikey, name, author, org,
> callback){
>     var json_data = {"name":name, "author":author, "owner_org":org};
>     json_data = JSON.stringify(json_data);
>     action_post(base_ckan_url+"/api/3/action/package_create", json_data,
> apikey, callback);
> }
>
> I do an ajax POST with api key in headers (the action_post() function).
>
> I think the parameter take both ids and names (not display name, but url
> name) of organisation. Hope that helps.
>
>
>
> On 7 June 2013 08:36, Paul Hermans <paul at proxml.be> wrote:
>>
>> Hi,
>>
>> context: API 3 in CKAN 2.0
>>
>> I'm trying to include the organization, which has been already created in
>> CKAN,  in the JSON payload of a package_create.
>> But whatever I try I always get as result organization: null.
>>
>> If I look at the help which is part of the response after the POST, I
>> notice that the param:organization is not mentioned herein.
>>
>> What am I missing?
>>
>>
>> Paul
>>
>>
>>
>>
>> _______________________________________________
>> ckan-dev mailing list
>> ckan-dev at lists.okfn.org
>> http://lists.okfn.org/mailman/listinfo/ckan-dev
>> Unsubscribe: http://lists.okfn.org/mailman/options/ckan-dev
>>
>
>
>
> --
> Med venlig hilsen - Best regards,
>
> Henrik Korsgaard
> Phone: +45 22377114
> Office: CAVI 114b, Aarhus University
>
> NB. I am slowly migrating my university related correspondence to my
> official AU mail: korsgaard at cavi.au.dk - feel free to contact me at that
> address if relevant.
>
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> http://lists.okfn.org/mailman/listinfo/ckan-dev
> Unsubscribe: http://lists.okfn.org/mailman/options/ckan-dev
>




More information about the ckan-dev mailing list