node.js SDK for Cagliari Open Data
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
test
.gitignore
LICENSE
README.md
index.js
package.json

README.md

Cagliari Open Data SDK for node.js

NPM

About

Basic node.js libraries to use Cagliari Open Data API endpoints.

Supported Datasets and Endpoints

  • Traffic

Installation

npm install cagliari-opendata

Basic Example

Getting all installed traffic monitoring stations:

var opendata = require('cagliari-opendata');
var traffic = opendata.traffic;

traffic.getStations(function(err, stations){

        if(!err){
                    console.log(stations);
        }

});

API

All functions are asynchronous, thus a callback(err, data) is mandatory as the last parameter in a call.


getStations(cb)

Gets all available traffic stations installed in the city.

A JSON is returned.


getStation(id, cb)

Gets info about a particular station given its id.

A JSON is returned.

  • id is the numeric or String id of the station

getStationData(id, startDate, endDate, cb)

Gets measurement data from all the sensors in a station, given its id.

A JSON is returned.

  • id is the numeric or string id of the station
  • startDate a Date representing the start date/time for required measurements (mandatory)
  • endDate a Date representing the end date/time for required measurements (optional)

getSensorData(id, startDate, endDate, cb)

Gets measurement data from for a specific sensor, given its id.

A JSON is returned.

  • id is the numeric or string id of the sensor
  • startDate a Date representing the start date/time for required measurements (mandatory)
  • endDate a Date representing the end date/time for required measurements (optional)

Links

Contributors

Antonio PintusGitHub/pintuxTwitter/@apintux

License - "MIT License"

Copyright (c) 2015-2016 Paraimpu srl, https://www.paraimpu.com

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.