[ckan-discuss] CKAN API examples using Python?

Signell, Richard rsignell at usgs.gov
Mon Nov 18 13:22:14 UTC 2013


Adria,

I tried to follow these examples, but I have not been able to get
geospatial POST requests working on catalog.data.gov:

http://opendata.stackexchange.com/questions/1286/catalog-data-gov-using-ckan-api-with-python-requests-package

Does anyone see what I'm doing wrong?

Thanks very much,

-Rich

On Wed, Nov 13, 2013 at 6:30 AM, Adrià Mercader <adria.mercader at okfn.org> wrote:
> Hi,
>
> For searching datasets you want to use the package_search method of
> the action API:
>
> http://docs.ckan.org/en/latest/api.html#ckan.logic.action.get.package_search
>
> You can use the ckanapi client [1] for this or call the API directly
> as shown on the healthdata.gov examples
>
> The search params in your case would be something like (not tested):
>
> # WMS + keyword
> {"q": "salmon",
>  "fq": "res_format:WMS"}
>
> # WMS + temporal
> {"q": "metadata_modified:[2013-06-01T00:00:00.000Z TO NOW]",
>  "fq": "res_format:WMS"}
>
> # WMS + spatial
> {"extras":{"ext_bbox":"-121,45,-120,46"},
>  "fq": "res_format:WMS"}
>
> Hope this helps,
>
> Adrià
>
>
> [1] https://github.com/open-data/ckanapi
>
> On 13 November 2013 04:52, Huang-Wei Chang <chang.huangwei.01 at gmail.com> wrote:
>> The examples on healthdata.gov are very helpful. Thanks a lot, Joshua!
>>
>> On Tue, Nov 12, 2013 at 6:33 AM, Joshua Tauberer
>> <tauberer+consulting at govtrack.us> wrote:
>>> Hi, Richard.
>>>
>>> We have some examples here for the datastore API, though it's similar to
>>> other APIs:
>>>
>>> http://healthdata.gov/data-api
>>>
>>> --
>>> - Joshua Tauberer
>>> - http://razor.occams.info
>>>
>>>
>>>
>>>
>>> On 11/12/2013 08:57 AM, Signell, Richard wrote:
>>>>
>>>> I'd like to use Python to construct queries and decode responses to
>>>> the CKAN API.
>>>>
>>>> Specifically I'd like to conduct a geospatial, temporal and keyword
>>>> search of catalog.data.gov, returning only datasets that have specific
>>>> format type (e.g. Esri REST, or WMS).
>>>>
>>>> Does anyone have some examples of Python code that help construct
>>>> these type of queries and process the responses?
>>>>
>>>> (I know about ckanclient (https://github.com/okfn/ckanclient), but I
>>>> couldn't figure out how to use it to do this kind of work.)
>>>>
>>>> Thanks,
>>>> Rich
>>>>
>>>
>>>
>>> _______________________________________________
>>> ckan-discuss mailing list
>>> ckan-discuss at lists.okfn.org
>>> http://lists.okfn.org/mailman/listinfo/ckan-discuss
>>> Unsubscribe: http://lists.okfn.org/mailman/options/ckan-discuss
>>
>> _______________________________________________
>> ckan-discuss mailing list
>> ckan-discuss at lists.okfn.org
>> http://lists.okfn.org/mailman/listinfo/ckan-discuss
>> Unsubscribe: http://lists.okfn.org/mailman/options/ckan-discuss
> _______________________________________________
> ckan-discuss mailing list
> ckan-discuss at lists.okfn.org
> http://lists.okfn.org/mailman/listinfo/ckan-discuss
> Unsubscribe: http://lists.okfn.org/mailman/options/ckan-discuss



-- 
Dr. Richard P. Signell   (508) 457-2229
USGS, 384 Woods Hole Rd.
Woods Hole, MA 02543-1598


More information about the ckan-discuss mailing list