npm install canlii-api
var api = require('canlii-api');
api.config({
api_key: 'YOUR API KEY'
});
api.caseBrowse({databaseId: 'csc-scc', caseId: '2008scc9'}, function(error, result) {
console.log(result);
});
The condensed case and legislation entries returned by the API methods can be fed back into the API to return the full case entries, like so:
api.caseBrowse({databaseId: 'csc-scc', offset: 0, resultCount: 1}, function(error, result) {
var condensedCase = result.cases[0];
console.log(condensedCase);
api.caseBrowse(condensedCase, function(error, result) {
console.log(result);
});
});
This should return something like:
{
"databaseId": "csc-scc",
"caseId": "2014scc40",
"title": "Canadian National Railway Co. v. Canada (Attorney General)",
"citation": "2014 SCC 40 (CanLII)"
}
{
"databaseId": "csc-scc",
"caseId": "2014scc40",
"url": "http://canlii.ca/t/g6z0w",
"title": "Canadian National Railway Co. v. Canada (Attorney General)",
"citation": "2014 SCC 40 (CanLII)",
"language": "en",
"docketNumber": "35145",
"decisionDate": "2014-05-23"
}
caseBrowse normalizes caseId in returns from the API (contrary to the documentation, the API returns an object instead of a string when listing cases).