[ckan-dev] Example for API usage (e.g. member_create)
Vitor Baptista
vitor at vitorbaptista.com
Wed Apr 10 12:15:20 UTC 2013
Adrià,
Added in https://github.com/okfn/ckan/issues/747.
Cheers,
Vítor Baptista.
2013/4/10 Adrià Mercader <adria.mercader at okfn.org>
> Hi,
>
> There are obviously a number of issues with member_create, as Heinrich
> has painfully found, and the docs are misleading [1].
>
> It looks like you need to use the ids in both "object" and "id", you
> can not use the name. The "capacity" value needs to be one of "public"
> or "private" when adding a package to a group.
>
> So this should work:
>
> >curl <myckan>/api/3/action/member_create -d '{"object":"<package_id>",
> "id":"<group_id>", "object_type":"package", "capacity": "public"}' -H
> "Authorization: <api_key>"
>
>
> @Vitor, can you create an issue to address all of these?
> * Support name and id (or update the docs if not possible to use name)
> * Document possible capacities
> * 500 if group is not found, more generally check if group and object
> exist, and that capacity is allowed
>
> Thanks,
>
> Adrià
>
>
>
> [1]
> http://docs.ckan.org/en/latest/ckan.logic.action.create.html#ckan.logic.action.create.member_create
>
> On 10 April 2013 00:54, Vitor Baptista <vitor at vitorbaptista.com> wrote:
> > Hi Heinrich,
> >
> > The problem with your request is that "object" should be the Package's id
> > (i.e. f2289f02-4ae7-4600-8adc-3ccd450b9498), not its name. Also, I'm not
> > sure if capacity = 3 means something. Looked through the code but
> couldn't
> > find anything. The capacity values I found were public and private, but I
> > might be wrong.
> >
> > Cheers,
> > Vítor Baptista.
> >
> >
> > 2013/4/8 Heinrich Widmann <widmann at dkrz.de>
> >>
> >> Hello,
> >> sorry for the newbie question but I'm still struggling with the basic
> >> usage of CKAN APIs.
> >>
> >> We managed to add and update data sets within our CKAN instance.
> >> Now I want to add datasets to groups by using member_create.
> >> My implemention in python returned no error, but the data set is not
> added
> >> to the wanted group of CKAN.
> >> So I tried to test it with curl from command line and submit something
> >> like :
> >>
> >> >curl <myckan>/api/3/action/member_create -d '{"object":"test3",
> >> > "id":"enes", "object_type":"package", "capacity": "3"}' -H
> "Authorization:
> >> > <api_key>"
> >>
> >> to add (existing) dataset test3 to the group 'ENES' (created the group
> >> with upper case letters, but I thing all CKAN objects are named lower
> case
> >> ?).
> >> ( Irecognized, that "capacity" must be set, but what is the appropriate
> >> value ?)
> >>
> >> The response is ... "success": true ..., but if I check no data set is
> >> added to group CKAN.
> >>
> >> What's going wrong ?
> >> Or more general : How can I test (and learn to use) APIs and get more
> >> verbose error messages to see what's going on.
> >>
> >> Best,
> >> Heinrich
> >>
> >> --
> >> -----------------------------\\---------------------------------------
> >> Heinrich Widmann \\ Deutsches Klimarechenzentrum GmbH
> >> Phone: +49 40 41173 282 \\ Abteilung Datenmanagement
> >> FAX: +49 40 41173 476 \\ Bundesstr. 45a
> >> Email: widmann at dkrz.de \\ D-20146 Hamburg
> >> http://www.dkrz.de \\ Germany
> >> -----------------------------------\\---------------------------------
> >>
> >>
> >> _______________________________________________
> >> 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
> >
> >
> >
> > _______________________________________________
> > 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
> >
>
> _______________________________________________
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20130410/df9a5168/attachment-0001.html>
More information about the ckan-dev
mailing list