[ckan-dev] Search API does not return resource_type
Sean Hammond
sean.hammond at okfn.org
Tue Aug 14 20:13:43 UTC 2012
Hi Phillip,
Sorry for the long delay in getting back to you, things have been very
busy. Have you made any progress on your issue?
I'm doubly sorry because there is a simple answer to your question. The
package_search action of the CKAN API v3 returns more detailed dicts for
all of the package's resources including their resource types. Example:
curl 'http://127.0.0.1:5000/api/action/package_search' -d '{"q": "foobar"}'
You can find detailed docs for CKAN's v3 API here:
http://docs.ckan.org/en/latest/apiv3.html
those docs are for the current development version of CKAN (1.8 beta),
so not everything documented there will work with CKAN 1.5 (for example
the GET-able actions do not work, you have to POST to them). There is
also documentation for the CKAN API v3 in the CKAN 1.5 docs so you might
want to consult that instead, but it is not as detailed.
On 31/07/12 12:00, Philipp Lämmel wrote:
> Hey all,
>
> first of all, thanks for providing such a nice piece of software.
>
> Our use case is as follows:
>
> We preview for each dataset the resources, but we want to exclude all
> documentation. For documentations, we use the resource_type field and
> set it explicitly to documentation.
>
> We are using CKAN 1.5.1 with a call to api/2/search/ to find relevant
> packages with all_fields=1 (e.g.
> <ckan-instance>/api/2/search/dataset?q=test&all_fields=1). We realised
> that the returned JSON does not contain the resource_type of each
> resource. Therefore, we are not able to distinguish between files and
> documentation.
> Is there any way to retrieve this information without making an API call
> for each resource?
>
> Are there any plans to integrate resource_type like "res_url" or
> "res_format"? We realised that in the latest CKAN version you added a
> data_dict, which contains the relevant information. Should we use this
> field or does a more elegant way exist?
>
>
> Thanks,
>
> Philipp
>
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> http://lists.okfn.org/mailman/listinfo/ckan-dev
More information about the ckan-dev
mailing list