Skip to content

Instantly share code, notes, and snippets.

@mheadd
Created May 30, 2012 14:10
Show Gist options
  • Select an option

  • Save mheadd/2836574 to your computer and use it in GitHub Desktop.

Select an option

Save mheadd/2836574 to your computer and use it in GitHub Desktop.
A simple example using the Node.js module for Open311 in Baltimore.
var util = require('util');
var Open311 = require('open311').Open311;
var options = {
'endpoint': '311test.baltimorecity.gov',
'service_path': '/open311/v2/',
'jurisdiction_id': 'baltimorecity.gov'
};
var report = new Open311(options);
report.getServiceList('json', function(error, data) {
if(error) {
util.puts('WARNING: ' + data);
}
else {
var services = JSON.parse(data);
for(var i = 0; i < services.length; i++) {
util.puts('Service Name: ' + services[i].service_name);
util.puts('Service Code: ' + services[i].service_code);
util.puts('------');
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment