# iRedAdmin API
A programmer friendly interface for iRedAdmin (OSE version)
# Known Limitations
- Only supports MD5 passwords
- Only supports MySQL
# Getting Started
- $ virtualenv -p $(which python2.7) venv
- $ source venv/bin/activate
- (venv)$ python setup.py develop
Before you can start making API calls, you must initialize a connection to the database back end you wish to manage.
To do so simply call the init_db method with a SQLAlchemy database URL. If you’re unclear on how to create one, see: http://docs.sqlalchemy.org/en/latest/core/engines.html#database-urls
mailapi.domain.get_all_domains() # throws a RuntimeError
mailapi.init_db(‘mysql://scott:firstname.lastname@example.org:3306/vmail’) # Initialize the db connection
mailapi.domain.get_all_domains() # works!
# Need Help?
I suggest you look at the test cases in ./tests as they illustrate how this package should be used and the expected outcomes.
# Running Unit Test Suite
(venv)$ TEST_DB_CONN_STR=’mysql://scott:email@example.com:3306/vmail’ python setup.py test
# I Need Feature x, y, z
Lol, fork me bro
- sorts mailboxes by username
- Custom exception class definitions
- They are mostly self-explanatory, but here is the break down:
- AliasExists: raised when trying to create an alias that already exists in the database
- DbInitError: raised when init_db has not been called
- MailboxExists: raised when adding a mailbox that already exists in the database
- NoSuchMailbox: raised when trying to access a mailbox that does not exist in the database
- DomainExists: raised when trying to create a domain that already exists
- NoSuchDomain: raised when trying to access a domain that does not exist in the database
- bookkeeping fixes:
- populates created and modified date fields when adding a mailbox
- populates modified and lastpasswordchange fields when resetting password
- fixes issue where the all aliases were not deleted when deleting a mailbox
- mailbox search
- reset mailbox password
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.