[ckan-dev] CKAN 2.2 file upload and package_create

Ian Ward ian at excess.org
Mon Sep 8 18:35:49 UTC 2014


On Mon, Sep 8, 2014 at 1:18 PM, Milica Knezevic
<knezevic.milica at gmail.com> wrote:
> Hi,
>
> I need to create a package which will contain several resources. These
> resources correspond to files that are uploaded to CKAN (I'm using
> FileStore). Is it possible in CKAN 2.2 to do this (create new package,
> upload files and create corresponding resources) via single api call
> package_create? I know how this can be done for resource that are linked to
> external files, but when file upload comes into play, I'm not sure if it is
> feasible using just package_create.

In case you're interested, the reason we can't upload multiple files
is because our api controller doesn't have a way to turn
multipart/form-data into the nested objects that package_create needs.
The 'upload' field is in the resource, and package_create's resources
are objects within a 'resource' list.

We could come up with a mapping like: a multipart field named
"resources/0/upload" that would mean "the upload field of the first
resource". It could be useful if you wanted to offer a page with
multiple upload boxes or something. Pull requests are welcome :-)

Ian



More information about the ckan-dev mailing list