nodejs package for factual api
This is the Factual-supported Node.js driver for Factual's public API.
$ npm install factual-api
Include this driver in your projects:
var Factual = ;var factual = 'YOUR_KEY' 'YOUR_SECRET';
If you don't have a Factual API account yet, it's free and easy to get one.
// Full-text search:factual;// Row filters:factual;factual;factual;// Geo filter:factual;// Get a row by factual id:factual;
// show top 5 cities that have more than 20 Starbucks in Californiafactual;
// resovle from name and address infofactual;// resolve from name and geo locationfactual;
Doc: http://developer.factual.com/api-docs/#Match Match the data with Factual's, but only return the matched Factual ID:
Doc: http://developer.factual.com/places-crosswalk/ Query with factual id, and only show entites from Yelp:
Or query with an entity from Foursquare:
Doc: http://developer.factual.com/api-docs/#Multi Query read and facets in one request:
var readQuery = factual;var facetsQuery = factual;factual;
Note that sub-responses in multi's response object might be factual api's error responses.
Doc: http://developer.factual.com/api-docs/#Geocode Get the nearest valid address from a latitude and longitude
Doc: http://developer.factual.com/api-docs/#Geopulse Get geographic attributes from a latitude and longitude
World Geographies contains administrative geographies (states, counties, countries), natural geographies (rivers, oceans, continents), and assorted geographic miscallaney. This resource is intended to complement the Global Places and add utility to any geo-related content.
// callback to handle all the diffsvar now = ;var start = now - 7*24*3600*1000; // last weekfactual;// callback to handle each difffactual;
Doc: http://developer.factual.com/api-docs/#Clear Clear existing attributes in an entity
The error object is the first argument of the callback functions, it will be null if no errors.
To see detailed debug information at runtime, you can turn on Debug Mode:
// start debug modefactual;// run your querie(s)// stop debug modefactual;
Debug Mode will output useful information about what's going on, including the request sent to Factual and the response from Factual, outputting to stdout and stderr.
If you want to send the requests to other hosts/port instead of "http://api.v3.factual.com:80", you can set it manually:
// 1.set globallyfactual;// back to defaultfactual;// 2. set for each requestfactual;
You can set the request timeout(in milliseconds) now:
// set the timeout as 1 secondfactual;// clear the custom timeout settingfactual;
You will get [Error: socket hang up] for custom timeout errors.
If you think you've identified a specific bug in this driver, please file an issue in the github repo. Please be as specific as you can, including:
If you are having any other kind of issue, such as unexpected data or strange behaviour from Factual's API (or you're just not sure WHAT'S going on), please contact us through GetSatisfaction.