Skip to content

Latest commit

 

History

History
72 lines (54 loc) · 1.42 KB

README.md

File metadata and controls

72 lines (54 loc) · 1.42 KB

canlii-api-node

Installation

npm install canlii-api

Usage

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"
}

Methods

caseBrowse

caseBrowse normalizes caseId in returns from the API (contrary to the documentation, the API returns an object instead of a string when listing cases).

legislationBrowse

caseCitatorTease

search