[ckan-dev] using a java client to upload files to a dataset created through the datahub.io website

Ross Jones ross at servercode.co.uk
Thu Jan 24 09:34:32 UTC 2013


Hi,

Yes, sorry Sean is right, it doesn't support uploading of files.  I don't have any time at present to add this, but will gladly accept a PR if you have time and inclination to add it?  Unfortunately with it being Java it is overly verbose given the simplicity of the CKAN API :(

Ross


On 24 Jan 2013, at 09:08, Sean Hammond wrote:

> Hey, I don't think CKANClient-J supports file uploading, although you
> might try contacting rossjones about it.
> 
> You can upload files using the Python ckanclient though. As I recall
> this wasn't simple to implement in Python ckanclient, the code that
> handles it starts here, in case this is of any help to you:
> 
> https://github.com/okfn/ckanclient/blob/master/ckanclient/__init__.py#L473
> 
> On Wed, Jan 23, 2013 at 11:14:33PM +0100, Clement Levallois wrote:
>> Hi,
>> 
>> 
>> I created a dataset on datahub.io and uploaded 2 files in it through the
>> website, as a test. I see that these files are hosted at:
>> https://ckannet-storage.commondatastorage.googleapis.com etc...
>> 
>> Now, programmatically, I use the Ckan Java client to modify the metadata of
>> these 2 files (jpeg files), using the resource_update method described here:
>> http://docs.ckan.org/en/latest/apiv3.html#action-api
>> 
>> It works well.
>> 
>> The next step is that I would like to upload new resources (and the
>> corresponding files) to this dataset, also through the API.
>> 
>> I see the "resource_create" method here:
>> http://docs.ckan.org/en/latest/apiv3.html#action-api
>> 
>> But this does not actually upload the file, it just describes the resource.
>> 
>> I've checked this page about file uploads
>> http://docs.ckan.org/en/latest/filestore.html#metadata-api
>> 
>> => but I am stuck, do the instructions on this page apply to what I want to
>> achieve? how do I implement that in Java (I suppose the Ckan Java client
>> would already take care of most of the boilerplate?) Any pointer would be
>> much appreciated!
>> 
>> Best,
>> 
>> Clement
>> 
>> 
>> 
>> --------------------------------------------
>> Clement Levallois, PhD
>> Erasmus University Rotterdam
>> The Netherlands
>> 
>> pro website<http://www.erim.eur.nl/ERIM/People/Person_Details?p_aff_id=4321>
>> / personal website <http://www.clementlevallois.net/>
>> 
>> twitter and skype: @seinecle
>> Discover the NESSHI project: http://www.nesshi.eu
> 
>> _______________________________________________
>> 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





More information about the ckan-dev mailing list