opensandiego / sd-sweepaware

City of San Diego streetsweeping SMS alerts
http://opensandiego.org
10 stars 11 forks source link

Begin REST API for adding alerts #10

Closed slester closed 8 years ago

slester commented 9 years ago

You can test this with npm install to get the latest module additions, then start the server with npm start In another terminal window, curl -X POST -H "Content-Type: application/json" -d '{"phoneNumber":"4234234233", "requestedAlerts":["one","two"]}' http://localhost:3000/alert/add then connect to your MongoDB instance to check that you now have two notifications waiting for approval:

$ mongo
MongoDB shell version: 3.0.5
connecting to: test
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, see
        http://docs.mongodb.org/
Questions? Try the support group
        http://groups.google.com/group/mongodb-user
> use sweepaware
switched to db sweepaware
> db.alerts.find()
{ "_id" : ObjectId("55d8079d673f2e206020e916"), "phoneNumber" : "4234234233", "emailAddress" : null, "addressID" : "one", "emailEnabled" : false, "phoneEnabled" : false, "requestHash" : "3321409361440221085608" }
{ "_id" : ObjectId("55d8079d673f2e206020e917"), "phoneNumber" : "4234234233", "emailAddress" : null, "addressID" : "two", "emailEnabled" : false, "phoneEnabled" : false, "requestHash" : "3321409361440221085608" }