[ckan-dev] Filestore API - error (Matthew Fullerton)

Matthew Fullerton matt.fullerton at gmail.com
Tue Jan 17 16:37:49 UTC 2017


Hi Pedro,
It looks like you can:
http://docs.ckan.org/en/latest/api/#ckan.logic.action.create.package_create

Says you can include a list of resources to add, structured the same way as
a resource_create API call. Not sure how to get the File-Loading bit into
Curl though for that case...

-Matt

On 13 January 2017 at 18:32, Pedro Ferro <pedro.ferro at gmail.com> wrote:

> Thanks a lot Matt !
> It worked quiet well
>
> I also was confusing concepts. (dataset and resource)
> I thought that what I was doing created a new dataset and also loaded the
> resource.
>
> Is there a way to create a dataset and also load a resource via the
> Filestore API?
>
> thanks,
> Pedro
>
> 2017-01-13 11:44 GMT+00:00 <ckan-dev-request at lists.okfn.org>:
>
>>
>> Hi Pedro,
>>
>> On 13 January 2017 at 12:25, Pedro Ferro <pedro.ferro at gmail.com> wrote:
>>
>> > Thank you all for the help but still can't understand how to do it. (you
>> > guys have to have patience to put up with a basic non IT guy...)
>> >
>> > I'm running CKAN 2.5.3 in a VM.
>> > At the VM, Ckan is running under 127.0.0.1:5000
>> > Outside the VM, CKAN is running 10.0.70.130:5000
>> >
>> >
>> >
>> > two kinds of doubts:
>> >
>> > --> what you meen "supply a "url" property" ?
>> >  I did this but didn't work:
>> >
>> > curl -H'Authorization: c72f0189-dae9-4606-9e3d-debf5b560268' "
>> >> http://localhost:5000/api/action/resource_create" --form
>> >> upload=@/tmp/distrito_conc_escolaridade.geojson --form
>> >> package_id='desemprego' --form url='http://localhost:5000'
>> >>
>> >
>> >
>> >
>> >>
>> >
>> > --> supply package_id
>> > thought that the  package_id was the name of the new dataset we are
>> > uploading
>> >
>> > but I also tried with the id that appears in the url when edit a
>> existent
>> > dataset and got an error to
>> >
>> > curl -H'Authorization: c72f0189-dae9-4606-9e3d-debf5b560268' "
>> >> http://localhost:5000/api/action/resource_create" --form
>> >> upload=@/tmp/distrito_conc_escolaridade.geojson --form
>> >> package_id='4c0d8df1-84d6-492d-af81-ba87f1568389'--form  url= '
>> >> http://localhost:5000'
>> >>
>> >
>> >
>> > {"help": "http://10.0.70.130:5000/api/3/action/help_show?name=resourc
>> >> e_create", "success": false, "error": {"url": ["Valor em falta"],
>> >> "__type": "Validation Error"}}curl: (6) Could not resolve host: url=
>> >> <!DOCTYPE html>
>> >>
>> >
>> Maybe you're almost there. Add a space between that package id sting and
>> the --form part and remove the space between the = sign and the url value.
>> The package id you are using might work, but you can/should also use the
>> simplified name (i.e. name, not title) that CKAN gives the dataset (the
>> "parent" for this resource, that you are adding - packages or datasets
>> contain resources which hold the actual data). I.e. 'castilla-y-leon' for
>> http://demo.ckan.org/dataset/castilla-y-leon.
>>
>> I.e., something like this, but you need to replace it with your package ID
>> (name):
>> curl -H 'Authorization: c72f0189-dae9-4606-9e3d-debf5b560268' "
>> http://localhost:5000/api/action/resource_create" --form
>> upload=@/tmp/distrito_conc_escolaridade.geojson --form
>> package_id='package-name' --form  url='http://localhost:5000'
>>
>> Best,
>> Matt
>>
>>
>>
> _______________________________________________
> 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/20170117/6296bd7f/attachment-0003.html>


More information about the ckan-dev mailing list