Datahub API loses query parameters after redirect

Hi Open Data friends,

The Datahub API uses query parameters in order to retrieve information, but these parameters are currently being removed because the server loses them in redirects.

Here is a particular example; notice that the original request URI contains ?id=270a, but the redirect URI no longer contains it:

$ curl -vL "http://datahub.io/api/action/organization_show?id=270a"
> GET /api/action/organization_show?id=270a HTTP/1.1
> Host: datahub.io
> User-Agent: curl/7.53.1
> Accept: */*

< HTTP/1.1 302 Found
< Date: Sun, 03 Sep 2017 06:25:14 GMT
< Content-Type: text/plain; charset=utf-8
< Content-Length: 73
< Connection: keep-alive
< Set-Cookie: __cfduid=d50eba1741b2be0cdef67ac675b9849e11504419913; expires=Mon, 03-Sep-18 06:25:13 GMT; path=/; domain=.datahub.io; HttpOnly
< X-Powered-By: Express
< Location: https://old.datahub.io/api/action/organization_show
< Vary: Accept
< set-cookie: connect.sid=s%3AadA_LdIs0_XUTekr2yRHpLSNhFwsAQLJ.zddMrtw53pGjwb3WzUks6%2F0WrsHlTOzxPjUA5m20vfs; Path=/; Expires=Sun, 03 Sep 2017 06:26:14 GMT; HttpOnly
< Server: cloudflare-nginx
< CF-RAY: 3986a16da09e2b9a-AMS

> GET /api/action/organization_show HTTP/2
> Host: old.datahub.io
> User-Agent: curl/7.53.1
> Accept: */*

< HTTP/2 409 
< date: Sun, 03 Sep 2017 06:25:14 GMT
< content-type: application/json;charset=utf-8
< content-length: 160
< set-cookie: __cfduid=d27b5560cea8ffe0a0e91e8e93553f2f51504419914; expires=Mon, 03-Sep-18 06:25:14 GMT; path=/; domain=.datahub.io; HttpOnly
< cache-control: no-cache
< pragma: no-cache
< server: cloudflare-nginx
< cf-ray: 3986a17058780c2f-AMS

I now see that this is caused by datahub.io referring to old.datahub.io. IINM then the whole CKAN API is now broken because the redirect from the new to the old Datahub website does not preserve query parameters.

This topic was automatically closed after 7 days. New replies are no longer allowed.

Hey,

Thanks for pointing this out.

You can now add an issue here Issues · datopian/datahub-qa · GitHub and join the tech discussions here datahubio/chat - Gitter