[ckan-dev] CKAN API 'extras' field

Ian Ward ian at excess.org
Thu Feb 11 13:49:24 UTC 2016


No, the only way to upload is with a file in a multipart post request (not
JSON). That's what Carl's example does and ckanapi does when you pass it a
file object.

On Thu, Feb 11, 2016 at 8:44 AM, Mike Sinclair <mm.sinclair08 at gmail.com>
wrote:

> Is there a way to do that without using CKANAPI - like a way to write that
> in json?
>
>
>>
> On Thu, Feb 11, 2016 at 5:36 AM, Carl Lange <carl at derilinx.com> wrote:
>
>> Hi Mike,
>>
>> Here's a working example:
>> https://github.com/ckan/ckan/issues/2769#issuecomment-173758267
>>
>> Cheers,
>> Carl
>>
>> On 11 February 2016 at 13:27, Mike Sinclair <mm.sinclair08 at gmail.com>
>> wrote:
>>
>>> I have it working via CKANAPI since it's just python. I'm not sure of
>>> the syntax of the 'upload' value for plain resource_create API call in the
>>> docs.
>>>
>>> Mike
>>>>>>
>>> On Thu, Feb 11, 2016 at 5:27 AM, Mike Sinclair <info at opengovgear.com>
>>> wrote:
>>>
>>>> I have it working via CKANAPI since it's just python. I'm not sure of
>>>> the syntax of the 'upload' value for plain resource_create API call in the
>>>> docs.
>>>>
>>>> Mike
>>>>>>>>
>>>> On Thu, Feb 11, 2016 at 5:17 AM, Pedro G Silva <
>>>> pedro.gracio at deimos.com.pt> wrote:
>>>>
>>>>>
>>>>> http://docs.ckan.org/en/latest/api/index.html#ckan.logic.action.create.resource_create
>>>>>
>>>>> On Thu, Feb 11, 2016 at 1:16 PM, Pedro G Silva <
>>>>> pedro.gracio at deimos.com.pt> wrote:
>>>>>
>>>>>> I don't believe there is a format for that, I'm pretty sure ckan can
>>>>>> take any file. Any specifics on the error? Although its commented on the
>>>>>> code it does work, I've done it before. You can check more about the inputs
>>>>>> here
>>>>>> http://docs.ckan.org/en/latest/api/index.html#ckan.logic.action.create.resource_view_create
>>>>>>
>>>>>> On Thu, Feb 11, 2016 at 1:12 PM, Mike Sinclair <
>>>>>> mm.sinclair08 at gmail.com> wrote:
>>>>>>
>>>>>>> For the 'upload' value in the API. Do you happen to know the format
>>>>>>> for that. I tried specifying the path of a local file but that didn't work.
>>>>>>>
>>>>>>> Mike
>>>>>>>>>>>>>>
>>>>>>> On Thu, Feb 11, 2016 at 4:02 AM, Mike Sinclair <
>>>>>>> mm.sinclair08 at gmail.com> wrote:
>>>>>>>
>>>>>>>> Thank you!
>>>>>>>>
>>>>>>>> Kinda verbose but it works. :)
>>>>>>>>
>>>>>>>> Mike
>>>>>>>>>>>>>>>>
>>>>>>>> On Thu, Feb 11, 2016 at 4:00 AM, Mike Sinclair <
>>>>>>>> info at opengovgear.com> wrote:
>>>>>>>>
>>>>>>>>> Thank you!
>>>>>>>>>
>>>>>>>>> Ah, nice and verbose. Second question..
>>>>>>>>>
>>>>>>>>> For some reason when I upload datasets through the api, they don't
>>>>>>>>> show up in their proper org and they are not found in the dataset listing.
>>>>>>>>> However, if I use the direct URL I can see the dataset.
>>>>>>>>> They are public and belong to the correct org.
>>>>>>>>>
>>>>>>>>> Mike
>>>>>>>>>>>>>>>>>>
>>>>>>>>> On Thu, Feb 11, 2016 at 3:45 AM, Pedro G Silva <
>>>>>>>>> pedro.gracio at deimos.com.pt> wrote:
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>    - extras:
>>>>>>>>>>    [
>>>>>>>>>>       -
>>>>>>>>>>       {
>>>>>>>>>>          - key: "Datatype",
>>>>>>>>>>          - value: "Grid"
>>>>>>>>>>          },
>>>>>>>>>>       -
>>>>>>>>>>       {
>>>>>>>>>>          - key: "Start Time",
>>>>>>>>>>          - value: "2015-11-27T00:00:00"
>>>>>>>>>>          },
>>>>>>>>>>       -
>>>>>>>>>>       {
>>>>>>>>>>          - key: "Stop Time",
>>>>>>>>>>          - value: "2015-12-03T00:00:00"
>>>>>>>>>>          },
>>>>>>>>>>       -
>>>>>>>>>>       {
>>>>>>>>>>          - key: "spatial",
>>>>>>>>>>          - value: "{"type":"Polygon","crs":{"type":"EPSG","properties":{"code":4326,"coordinate_order":"Long,Lat"}},"coordinates":[[[-8.8,39.8],[-8.8,40.4],
>>>>>>>>>>          [-9.4,40.4], [-9.4,39.8], [-8.8,39.8]]]}"
>>>>>>>>>>          }
>>>>>>>>>>       ],
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On Thu, Feb 11, 2016 at 10:58 AM, Mike Sinclair <
>>>>>>>>>> mm.sinclair08 at gmail.com> wrote:
>>>>>>>>>>
>>>>>>>>>>> Is there something I am doing wrong here? extras seem to break
>>>>>>>>>>> it..
>>>>>>>>>>>
>>>>>>>>>>> {
>>>>>>>>>>>     "name": "cemeteries13",
>>>>>>>>>>>     "title": "Cemeteries13",
>>>>>>>>>>>     "owner_org": "test",
>>>>>>>>>>>     "groups": [
>>>>>>>>>>>     {"name": "arts-and-culture"}
>>>>>>>>>>>     ],
>>>>>>>>>>>     "url": "upload",
>>>>>>>>>>>     "notes": "something here",
>>>>>>>>>>>     "state": "Active",
>>>>>>>>>>>     "extras": [
>>>>>>>>>>>       {"test": "the thing"}]
>>>>>>>>>>> }
>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>> _______________________________________________
>>>>>>>>>>> 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
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> [image: DEIMOS Engenharia, SA] <http://www.deimos.pt>
>>>>>>>>>> *Pedro Gracio Silva*
>>>>>>>>>> Aerospace Systems / Production Center
>>>>>>>>>>
>>>>>>>>>> *Av. D. Joao II, Lt 1.17.01, 10 • 1998-023 Lisboa, Portugal*
>>>>>>>>>> Ph: +351 21 893 3020 • Fax: +351 21 896 9099
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> _______________________________________________
>>>>>>>>>> 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
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>>
>>>>>>
>>>>>> [image: DEIMOS Engenharia, SA] <http://www.deimos.pt>
>>>>>> *Pedro Gracio Silva*
>>>>>> Aerospace Systems / Production Center
>>>>>>
>>>>>> *Av. D. Joao II, Lt 1.17.01, 10 • 1998-023 Lisboa, Portugal*
>>>>>> Ph: +351 21 893 3020 • Fax: +351 21 896 9099
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>>
>>>>>
>>>>> [image: DEIMOS Engenharia, SA] <http://www.deimos.pt>
>>>>> *Pedro Gracio Silva*
>>>>> Aerospace Systems / Production Center
>>>>>
>>>>> *Av. D. Joao II, Lt 1.17.01, 10 • 1998-023 Lisboa, Portugal*
>>>>> Ph: +351 21 893 3020 • Fax: +351 21 896 9099
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> 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
>>
>>
>
> _______________________________________________
> 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/20160211/ce7204f2/attachment-0003.html>


More information about the ckan-dev mailing list