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

Jay Daley jay at controlfreak.net
Thu Mar 13 20:08:26 UTC 2014


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




More information about the ckan-dev mailing list