Created
May 30, 2012 14:10
-
-
Save mheadd/2836574 to your computer and use it in GitHub Desktop.
A simple example using the Node.js module for Open311 in Baltimore.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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