Mifos API - Powering Extensibility

The following is our first "Technical Topic", a regular series of guest posts from developers in our community exploring some of the projects they're working on. Lukasz Chudy serves up a closer look at REST APIs.

The latest version of Mifos brings the new, exciting functionality - REST API module. Why is it so interesting?

Integrated REST API module allows one to execute numerous Mifos transactions with independence from the application User Interface. It means that you can disburse loans or apply deposits to a particular account via a simple URL link without using Mifos web interface. This simplicity gives you variety of possibilities.

By making Mifos “talk nicely” and interact with other applications, the extensibility of Mifos goes far beyond just a web-based MIS to manage the loan portfolio.  These APIs are a big leap forward in enabling you the community to shape Mifos to meet your needs. You can for example create your own scripts for managing customers and accounts or develop fully functional mobile application. Let’s put some light on the key functionalities included in the REST Api module.

REST API module provides a large set of methods which are responsible for variety of operations in Mifos.

Methods related to customers
displays detailed information about the client and his accounts
shows charges applied to the Group with current charges balance
allows to apply a charge to the particular customer
Methods connected to the personnel
shows all customers assigned to the Loan Officer
displays detailed information about the Office

The most widest set of methods are those related to the accounts:

Methods related to accounts
shows the complete repayment schedule of the particular Loan account
allows to disburse Loan on the specified day
gives ability to apply payment to Loan account
allows to apply deposit to Savings account
gives possibility to revert the last transaction

The complete list of the methods with detailed specification can be found here: http://mifosforge.jira.com/wiki/display/MIFOS/REST+API+Reference

REST API methods can be used to create your own scripts which allow you to easily execute any Mifos operation. Below you can see the sample script in Python for Loan repayment:

def loanRepayment():

   # get client details
   clientGlobalNumber, client = getClientDetails()

   # print client information
   print ' [Loan Repayment] '
   print ' Client Number: ' + clientGlobalNumber
   print ' Client Name: ' + client['clientDisplay']['displayName']
   print ' Outstanding Loans'

   # create the map of client loan accounts
   i = 1
   param = []
   for l in client['loanAccountsInUse']:
      print ' '+str(i) +'. '+ l['prdOfferingName']+': '+l['outstandingBalance']
      i = i+1
      param.insert(i, l['globalAccountNum'])

   # read loan number from the user
   loan = raw_input('Select loan to repay: ')

   # read repayment amount from the user
   amount = raw_input('Enter amount: ')

   repayLoan(param, loan, amount, clientGlobalNumber)

Another way of using REST API methods is to create for example a mobile application which gives you remote access to the standard software from your phone. You can check how REST methods are used in Android application by downloading Mifos Android Client from the Android Market

Mifos Android Client will be widely described in my next guest blog post.

So to sum up, the REST API module integrated with Mifos opens a wide way of possibilities for the users, mainly by giving them possibility to create their own user interface and also by allowing them to remotely access the application from other devices like the mobile phone.


Authored by: 

Natalia Szprega

I'm a QA Engineer working to improve the quality of Mifos.