[ckan-dev] Accessing Data.gov's CKAN API through JavaScript

Andy Dufilie andy.dufilie at gmail.com
Sat Apr 19 15:00:53 UTC 2014


Hi ckan-dev,

I'm working on adding support for CKAN in Weave (oicweave.org).  I have it
working with demo.ckan.org, but not catalog.data.gov.
See this page for my tests, results shown at the end of this email:
http://jsfiddle.net/2xFq7/9/

I was getting the "Bad request - JSON Error: No request body data" error
from demo.ckan.org when I had the wrong Content-Type earlier, so I thought
setting the Content-Type may fix the problem with data.gov, but the CORS
preflight request fails on data.gov when I specify any request headers.

Does data.gov not want me to use the action API at all?  I noticed that it
does not allow me to use the package_list action.


Test results:
{
    "method": "GET",
    "url": "
http://demo.ckan.org/api/3/action/group_show?id=collectivites-locales&",
    "status": "200 OK",
    "success": true
}

{
    "method": "POST",
    "url": "http://demo.ckan.org/api/3/action/group_show",
    "params": {
        "id": "collectivites-locales"
    },
    "status": "200 OK",
    "success": true
}

{
    "method": "GET",
    "url": "http://catalog.data.gov/api/3/action/group_show?id=law1129&",
    "status": "400 Bad Request",
    "response": "Bad request - JSON Error: No request body data"
}

{
    "method": "POST",
    "url": "http://catalog.data.gov/api/3/action/group_show",
    "params": {
        "id": "law1129"
    },
    "status": "400 Bad Request",
    "response": "Bad request - JSON Error: No request body data"
}

{
    "method": "GET",
    "url": "http://catalog.data.gov/api/3/action/tag_show?id=2010-data&",
    "status": "200 OK",
    "success": true
}

{
    "method": "POST",
    "url": "http://catalog.data.gov/api/3/action/tag_show",
    "params": {
        "id": "2010-data"
    },
    "status": "409 Conflict",
    "success": false,
    "error": {
        "__type": "Validation Error",
        "id": "Missing value"
    }
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20140419/63b2a5f1/attachment-0002.html>


More information about the ckan-dev mailing list