[ckan-dev] Creating a Datastore resource via the API

Nigel Babu nigel.babu at okfn.org
Mon Mar 17 05:21:54 UTC 2014


Hello Jay,

I tried the following on demo and it worked fine:

curl -X POST http://demo.ckan.org/api/3/action/datastore_create -H
'Authorization: mykey' -d '{ "resource" : { "package_id" :
"rbnz-c1-monetary-aggregates" } }'

I'm guessing there was a small typo that threw your test off.

Nigel Babu

Developer  |  @nigelbabu <https://twitter.com/nigelbabu>

The Open Knowledge Foundation <http://okfn.org/>

Empowering through Open Knowledge

http://okfn.org/  |  @okfn <http://twitter.com/OKFN>  |  OKF on
Facebook<https://www.facebook.com/OKFNetwork> |
Blog <http://blog.okfn.org/>  |  Newsletter<http://okfn.org/about/newsletter>

 CKAN | http://ckan.org/ | @CKANproject
<http://twitter.com/CKANproject> |the world’s leading open-source data
portal platform


On 14 March 2014 02:29, Jay Daley <jay at controlfreak.net> wrote:

> A final follow up just to note that this worked successfully on my own
> install of CKAN so it looks like the demo site is stuffed somehow.
>
> Jay
>
> On 14/03/2014, at 9:08 am, Jay Daley <jay at controlfreak.net> wrote:
>
> >
> > On 13/03/2014, at 11:23 pm, Reinier Battenberg <
> reinier.battenberg at mountbatten.net> wrote:
> >
> >>
> >> did you also try a package_id like "jaystest" and then made it more
> complex
> >> (capitals, spaces and finally a ' ) until it breaks?
> >
> > I'm not sure what you mean?  I did have the package name wrong as it
> happens (used the org name not the dataset name) but I've since corrected
> and tried the following, all of which give the same error:
> >
> >       { "resource" : { "package_id" : "rbnz-c1-monetary-aggregates" } }
> >       { "resource" : { "package_id" : "rbnz-c1-monetary-aggregates" ,
> "name" : "m3-y-on-y"} }
> >       { "resource" : { "package_id" : "rbnz-c1-monetary-aggregates" ,
> "name" : "m3-y-on-y", "title" : "M3 Y on Y"} }
> >
> > I've also checked the package name through
> http://demo.ckan.org/api/3/action/package_list
> >
> > The full command, excluding my API key is:
> >
> >       curl -X POST http://demo.ckan.org/api/3/action/datastore_create-H "Authorization: <my key>" -d @ckan-create.json
> >
> > where ckan-create.json is a file with just one of the lines above in it.
> >
> > cheers
> > Jay
> >
> >>
> >> On Thursday 13 March 2014 22:53:08 Jay Daley wrote:
> >>> Hi
> >>>
> >>> As I understand it from the documentation I should be able to create a
> >>> Datastore resource by specifying "resource" and a dictionary that has
> the
> >>> package_id and not specify a resource_id .  e.g.
> >>>
> >>>     { "resource" : { "package_id" : "Jay's Test" } }
> >>>
> >>> which I'm using against
> http://demo.ckan.org/api/3/action/datastore_create
> >>> with a POST and my API key.
> >>>
> >>> However the error message I'm getting seems to contradict that:
> >>>
> >>>     "success": false, "error": {"message": "Missig id, can not get
> Resource
> >>> object", "__type": "Validation Error"}
> >>>
> >>> Have I misunderstood the documentation?
> >>>
> >>> cheers
> >>> Jay
> >>> _______________________________________________
> >>> 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
> >> --
> >> rgds,
> >>
> >> Reinier Battenberg
> >> Director
> >> Mountbatten Ltd.
> >> www.mountbatten.net
> >> tel: +256 758 801749
> >> twitter: @batje
> >> _______________________________________________
> >> 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
>
> _______________________________________________
> 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/20140317/85a1285f/attachment-0003.html>


More information about the ckan-dev mailing list