A Node.js library for the Sensis.com.au API (SAPI)
npm install sensis-sapiNode.js Sensis.com.au API (SAPI) Library
========================================
A library for searching the Sensis.com.au API (SAPI) in Node.js
Based upon official documentation and examples from other languages -
Dependencies
------------
* Node 0.8.X+
Installation
------------
> npm install sensis-sapi
Usage
------
var sapi = require('sapi');
sapi(query, options);
var sapi = require('sensis-sapi');
var options = {
key: 'XXXXXXXX', //Set to your API key
environment: 'test' //either 'prod' or 'test'. Defaults to test,
}
//Define search params,
var query = {
query: 'Restaurants',
location: 'Umina Beach',
sortBy: 'distance',
rows: 1
}
//Query SAPI
sapi(query, options, function(data){
if(data.code===200){
return console.log("Your closest restaurant is " + data.results[0].name + " at " + data.results[0].primaryAddress.addressLine + ", " + data.results[0].primaryAddress.suburb);
}
return console.log(data);
});
//node app.js returns > Your closest restaurant is 304 On West at 304 West St, Umina Beach
Fun Fact!
------
"SAPI", the acronym used for Sensis API, is also the Indonesian word for "cow". see (
To-Do
-----
* see (
Author
------
* Mobilise Me (
License:
--------
(The MIT License)
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.