This node module is a wrapper for the UW OpenData API. It is asynchronous but promised based and so presents a cleaner interface than traditional callbacks while still remaining efficient.
npm install uwapi
in the target project. The value returned by require('uwapi') is a constructor that consumes an api token and returns an object with methods for making queries.
var apiToken = 'blarg';var uwapi = apiToken;uwapi;
The package depends on kris kowal's Q library implementation of promises which should automatically be installed by npm.
Each endpoint is implemented as a function that returns a promise which resolves to the data payload obtained by the querying the endpoint with the provided parameters. Each endpoint path corresponds to a specific function as found in the REFERENCE.md file. Parameters are expected to be passed in to these functions as an object where the key corresponds to the parameter name. GET parameters can optionally be passed as a second argument.
//A 'normal' endpoint (the bulk of them)uwapi;//Endpoints which take GET parameters.uwapi;uwapi;
Set the environment variable uwApiToken and run 'npm test'
- Updated baseURL to use secured endpoints
- Added optional support for GET parameters (see README.md)
- Added the foodservicesSearch endpoint
- Added the resourcesSites endpoint
- Allow empty responses to propagate rather than throwing an error
- Make function names more consistent with endpoints
Bugs / Feature Requests
Please email any bugs or feature requests to firstname.lastname@example.org
Feel free to fork and issue Pull Requests.