[ckan-dev] API requests using JSONP return no results

Sean Hammond sean.hammond at okfn.org
Fri Feb 15 10:13:26 UTC 2013


> I am trying to make JSONP requests to the CKAN API (using a callback
> parameter as described at
> http://docs.ckan.org/en/latest/api.html#jsonp-support)..
> 
> When adding the callback parameter the response always comes back with no
> results.
> 
> Here is an example without a callback that returns three results:
> http://data.opencolorado.org/api/2/search/dataset?groups=denver&tags=recreation
> 
> Here is the same request with a callback that returns no results:
> http://data.opencolorado.org/api/2/search/dataset?groups=denver&tags=recreation&callback=abcd
> 
> Thoughts?

Hmm, yes, this looks like a CKAN bug, I was able to reproduce it on
demo.ckan.org (which is running a reasonably recent development version
of CKAN 2.0):

http://demo.ckan.org/api/2/search/dataset?q=spending
http://demo.ckan.org/api/2/search/dataset?q=spending&callback=abcd

The Search API that you're using is going to be deprecated in CKAN 2.0
in favor of the new Action API, so I think this bug in the legacy API
may be unlikely to get fixed at this point (although a pull request
would be welcome).

The Action API's package_search action doesn't seem to support jsonp:

http://demo.ckan.org/api/3/action/package_search?q=spending&callback=abcd

That may be another bug. @ckan-devs, what do you think? Should
package_search support jsonp like other actions do?




More information about the ckan-dev mailing list