Actionist is an iOS app and REST API created for my Capstone Project at Ada Developers Academy. Actionist is intended to streamline engagement with social justice and political actions from a mobile device.
From the iOS App, Users can retrieve a list of (and act on): Call-, Email-, or Event-type Actions. The Actionist API manages CRUD operations for the User, Call Action, Email Action, and Event Action resources.
Learn more about the project at: http://actionistapp.com/
See the iOS app code at: https://github.com/brookseakate/actionist-ios
The Actionist API is written in Python using Flask.
- Python 2.7.x
- Virtualenv
- Flask
- Flask-Script
- Flask-SQLAlchemy
- Flask-Migrate (Alembic)
- Flask-RESTful
- Flask-HTTPAuth
- python-dotenv
- PostgreSQL
- recommended: Postgres.app
- recommended: Postico
- psycopg2
- Python Faker (for seed generator scripts)
- phonenumbers (for seed generator scripts)
- less (recommended, for index page CSS)
Before cloning, be sure all necessary packages listed above are installed and executable from your path. Most packages can be installed with pip. (Here are some helpful getting-started guides for Flask and for Using PostgreSQL with Flask.)
Clone the repo:
$ git clone <this-repository-url>
$ cd actionist-api
Actionist API endpoints require HTTP Basic authentication. Assign a username and password for authorized HTTP requests. The application also needs to know your database path.
Define the following environment variables in a .env
file at the project root:
# .env
HTTP_AUTH_PASSWORD = "password"
HTTP_AUTH_USERNAME = "username"
SQLALCHEMY_DATABASE_URI = "database://your/database/URI"
# see sample db URI formats here: http://flask-sqlalchemy.pocoo.org/2.1/config/#configuration-keys
To run the application locally:
$ source venv/bin/activate
$ python application.py
When launched successfully, the application logs will confirm the local server's IP:
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
You can now make requests against your local server, running at: http://localhost:5000
To populate your database using the included seed generator scripts, run python manage.py dbseed
with the -c
flag to specify a quantity.
For example, to seed 10 each of Users, Call Actions, Email Actions, and Event Actions, run:
$ python manage.py dbseed -c 10
Actionist API endpoints require HTTP Basic authentication. Include your username and password with each request.
All responses are provided in JSON format.
NOTE: When running locally, <yourserver>
will be localhost:5000
by default.
http://<yourserver>/api/v1.0/
http://<yourserver>/api/v1.0/actions/
- GET: Retrieve a list of all Actions (Call, Email, or Event)
http://<yourserver>/api/v1.0/call_actions/
- GET: Retrieve a list of all Call Actions
- POST: Create a new Call Action
http://<yourserver>/api/v1.0/call_actions/<id>
- GET: Retrieve the specified Call Action
- PUT: Update the specified Call Action
- DELETE: Delete the specified Call Action
http://<yourserver>/api/v1.0/email_actions/
- GET: Retrieve a list of all Email Actions
- POST: Create a new Email Action
http://<yourserver>/api/v1.0/email_actions/<id>
- GET: Retrieve the specified Email Action
- PUT: Update the specified Email Action
- DELETE: Delete the specified Email Action
http://<yourserver>/api/v1.0/event_actions/
- GET: Retrieve a list of all Event Actions
- POST: Create a new Event Action
http://<yourserver>/api/v1.0/event_actions/<id>
- GET: Retrieve the specified Event Action
- PUT: Update the specified Event Action
- DELETE: Delete the specified Event Action
http://<yourserver>/api/v1.0/users/
- GET: Retrieve a list of all Users
- POST: Create a new User
http://<yourserver>/api/v1.0/users/<id>
- GET: Retrieve the specified User
- PUT: Update the specified User
- DELETE: Delete the specified User
The below sample requests run against a default local server (localhost:5000
). Substitute your server location if running on a different host.
- Get a list of all Actions:
curl -i -H "Content-Type: application/json" -X GET http://localhost:5000/api/v1.0/actions -u username:password
- Create a new User:
curl -i -H "Content-Type: application/json" -X POST -d '{ "user_name": "lunarox", "first_name": "Luna", "last_name": "Lovegood", "about": "Spells and outer space", "zip": "98101" }' http://localhost:5000/api/v1.0/users -u username:password
- Update a Call Action:
curl -i -H "Content-Type: application/json" -X PUT -d '{ "target_phone_number": "2065551212" }' http://localhost:5000/api/v1.0/call_actions/1 -u username:password
- Delete an Event Action:
curl -i -H "Content-Type: application/json" -X DELETE http://localhost:5000/api/v1.0/event_actions/123 -u username:password
For more information about API resources and parameters, see the Actionist ERD.
This project is released as open source under the MIT License.
- Ada Developers Academy Website
- Actionist App Website
- Actionist iOS Code
- My Website
- App Icon & Favicon: Protest by Chris Kerr from the Noun Project
- Bootstrap Theme (index page): New Age