Closed azanella closed 9 years ago
Seems dati.toscana.it absolutely wants some param in the GET:
http://dati.toscana.it/api/3/action/package_list gives "Richiesta non valida - Errore JSON: No request body data"
This doesn't work also:
http://dati.toscana.it/api/3/action/package_list?
By putting a random character such as 'a' after the '?' works:
interesting behavior.. :confused:
"No request body data" should indicate missing json body.. what's the returned HTTP status code / relevant headers?
This is the point in which the exception is raised.. have fun debugging that code :P
https://github.com/ckan/ckan/blob/master/ckan/controllers/api.py#L875
Sorry, for once even Refine can be more fun than this. Forced the GET in curl, got same error:
curl -X GET http://dati.toscana.it/api/3/action/package_list -v
* About to connect() to dati.toscana.it port 80 (#0)
* Trying 159.213.233.108...
* 0x80048e38 is at send pipe head!
* STATE: CONNECT => WAITCONNECT handle 0x80057b60; line 1032 (connection #0)
* Connected to dati.toscana.it (159.213.233.108) port 80 (#0)
* STATE: WAITCONNECT => DO handle 0x80057b60; line 1151 (connection #0)
> GET /api/3/action/package_list HTTP/1.1
> User-Agent: curl/7.29.0
> Host: dati.toscana.it
> Accept: */*
>
* STATE: DO => DO_DONE handle 0x80057b60; line 1236 (connection #0)
* STATE: DO_DONE => WAITPERFORM handle 0x80057b60; line 1352 (connection #0)
* STATE: WAITPERFORM => PERFORM handle 0x80057b60; line 1363 (connection #0)
* HTTP 1.1 or later with persistent connection, pipelining supported
< HTTP/1.1 400 Bad Request
< Server: nginx/1.1.19
< Date: Thu, 13 Mar 2014 14:04:31 GMT
< Content-Type: application/json;charset=utf-8
< Content-Length: 58
< Connection: keep-alive
< Pragma: no-cache
< Cache-Control: no-cache
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Methods: POST, PUT, GET, DELETE, OPTIONS
< Access-Control-Allow-Headers: X-CKAN-API-KEY, Authorization, Content-Type
<
* STATE: PERFORM => DONE handle 0x80057b60; line 1533 (connection #0)
* Connection #0 to host dati.toscana.it left intact
"Richiesta non valida - Errore JSON: No request body data"
now it works on dati toscana even without garbage parameters workaround, and I'm not much willing to put crap in the param list just to make this work on old ckan versions, so I'm closing it
Exception in thread "main" eu.trentorise.opendata.jackan.JackanException: Error while getting dataset. at eu.trentorise.opendata.jackan.ckan.CkanClient.getHttp(CkanClient.java:120) at eu.trentorise.opendata.jackan.ckan.CkanClient.getDatasetList(CkanClient.java:130) at eu.trentorise.opendata.ckanalyze.main.TestMain.main(TestMain.java:42) Caused by: org.apache.http.client.HttpResponseException: Bad Request at org.apache.http.client.fluent.ContentResponseHandler.handleResponse(ContentResponseHandler.java:47) at org.apache.http.client.fluent.ContentResponseHandler.handleResponse(ContentResponseHandler.java:40) at org.apache.http.client.fluent.Response.handleResponse(Response.java:85) at org.apache.http.client.fluent.Response.returnContent(Response.java:92) at eu.trentorise.opendata.jackan.ckan.CkanClient.getHttp(CkanClient.java:108) ... 2 more