This module was built to support integration with the White House's We The People petitions API. That service has now been discontinued by the White House, so we are regretfully archiving this project for now.
Easy installation with NPM
npm install whitehouse
This project is licensed under the BSD license.
Simply include the whitehouse
module and then create a new API object you can then call methods to
make requests.
var wh = require('whitehouse'),
whApi = wh.createWhiteHouse()
whApi.getPetitions(function(output) {
var obj = JSON.parse(output)
console.log(obj)
})
Exact details of available filters are on the We The People documentation.
Get all petitions call fn
with the data.
Get all petitions that match the filter
object, call fn
with the data.
Get petition matching id
call fn
with the data.
Get signatures matching petition id
call fn
with the data.
Get signatures matching petition id
and filter
call fn
with the data.
var wh = require('whitehouse'),
whApi = wh.createWhiteHouse()
whApi.getPetitions(function(output) {
var obj = JSON.parse(output)
console.log(obj)
})
whApi.getPetitions(function(output) {
var obj = JSON.parse(output)
console.log(obj)
})
- Add in actual tests
- Better JSON support
- Better streaming suport
- Improved documentation
- Improved error handling
- Support for node.js domains
When creating API objects the setting of an API Key is still supported from an earlier version of the API.
whApi = wh.createWhiteHouse(apiKey)
You can also pass a second parameter to the contructor to set the mock
value. This was originally
used to get mock requests for testing.
whApi = wh.createWhiteHouse(apiKey,true) // use mock requests