Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 10 Next »

A new module added for REST API in Release 2.2.x

Configuration

REST Services will be enabled by default.

Based on Spring 3.0 MVC it required minimal configuration. REST APIs are secure and uses Mifos existing authentication scheme including roles and permissions.

REST API implementation just simply uses existing services (ServiceFacade) to generate a JSON object to be send over the wire.

Using REST API - Client

The client would have to login before using REST API, it will be same ask user authentication and then client would have to maintain the Cookie data to be able to maintain session for the communication.

Spring RestTemplate based on Apache HTTPClient can be used for building a Java client.

Python cookielib can be used for maintaining Cookie for the session.  Example script https://github.com/mifos/head/blob/master/rest/scripts/mifos-rest.py

Similarly almost all the language would have already an existing library for this purpose and you can recommend one that can be listed here.

There is a youtube video which shows the use of python client http://www.youtube.com/watch?v=bY0BAPZEZEk

Testing

As REST API uses existing service facades it only need functional testing which is done by acceptance tests (see RESTAPITest.java)

API Documentation

Clients

getClientByNumber

TYPE

GET

URL

 BASE_URL/client/num-{globalCustNum}.json

PATH ARGUMENTS

globalCustNum

REQUEST PARAMS

 

RETURNS

ClientInformationDto

EXAMPLE RESPONSE

{
    "address": {
        "state": "",
        "country": "",
        "displayAddress": null,
        "city": "",
        "zip": "",
        "phoneNumber": ""
    },
    "customerMeeting": {
        "meetingSchedule": "Recur every 1 Week(s) on Monday",
        "meetingPlace": "rest"
    },
    "customerFlags": [],
    "clientPerformanceHistory": {
        "loanCycleNumber": 0,
        "lastLoanAmount": "0.0",
        "noOfActiveLoans": 2,
        "delinquentPortfolioAmount": "0.0",
        "totalSavingsAmount": "105.0",
        "meetingsAttended": 0,
        "meetingsMissed": 0,
        "loanCycleCounters": [
            {
                "counter": 1,
                "offeringName": "REST Loan Product A"
            },
            {
                "counter": 1,
                "offeringName": "REST Loan Product B"
            }
        ]
    },
    "recentCustomerNotes": [
        {
            "comment": "Active",
            "commentDate": "2011-09-12",
            "personnelName": "mifos"
        }
    ],
    "activeSurveys": false,
    "customerAccountSummary": {
        "globalAccountNum": "000100000000003",
        "nextDueAmount": "0.0"
    },
    "savingsAccountsInUse": [
        {
            "globalAccountNum": "000100000000006",
            "prdOfferingId": null,
            "prdOfferingName": "Savings A",
            "accountStateName": "Active",
            "accountStateId": 16,
            "savingsBalance": "10.0"
        },
        {
            "globalAccountNum": "000100000000007",
            "prdOfferingId": null,
            "prdOfferingName": "Savings B",
            "accountStateName": "Active",
            "accountStateId": 16,
            "savingsBalance": "95.0"
        }
    ],
    "customerSurveys": [],
    "loanAccountsInUse": [
        {
            "globalAccountNum": "000100000000004",
            "prdOfferingName": "REST Loan Product A",
            "outstandingBalance": "101.0",
            "totalAmountDue": "10.0",
            "accountStateName": "Active in Good Standing",
            "accountStateId": 5
        },
        {
            "globalAccountNum": "000100000000005",
            "prdOfferingName": "REST Loan Product B",
            "outstandingBalance": "1032.0",
            "totalAmountDue": "103.0",
            "accountStateName": "Active in Good Standing",
            "accountStateId": 5
        }
    ],
    "clientDisplay": {
        "displayName": "Client REST API",
        "branchId": 2,
        "customerId": 3,
        "loanOfficerId": 2,
        "dateOfBirth": "1986-06-06",
        "governmentId": "",
        "maritalStatus": null,
        "globalCustNum": "0002-000000003",
        "externalId": "",
        "customerActivationDate": "2011-09-12",
        "customerLevelId": 1,
        "customerStatusName": "Active",
        "spouseFatherName": "first last",
        "trainedDate": null,
        "familyDetails": null,
        "age": 25,
        "businessActivities": null,
        "citizenship": null,
        "educationLevel": null,
        "handicapped": null,
        "numChildren": null,
        "povertyStatus": "Very poor",
        "customerStatusId": 3,
        "loanOfficerName": "loan officer",
        "parentCustomerDisplayName": "Group-REST",
        "customerFormedByDisplayName": "loan officer",
        "blackListed": false,
        "branchName": "Branch Office",
        "clientUnderGroup": true,
        "ethnicity": null,
        "areFamilyDetailsRequired": false,
        "spouseFatherValue": "Spouse"
    }
}

Personnel

getCurrentPersonnel

TYPE

GET

URL

 BASE_URL/personnel/id-current.json

PATH ARGUMENTS

 

REQUEST PARAMS

 

RETURNS

PersonnelInformationDto

EXAMPLE RESPONSE

{
    "id":1,
    "displayName":"mifos",
    "status":{
        "name":"Active",
        "id":1
    },
    "userName":"mifos",
    "title":1,
    "locked":false,
    "levelId":2,
    "personnelId":1,
    "officeId":1,
    "personnelRoles":[{
            "name":"Admin",
            "id":1
        }
    ],
    "officeName":"Mifos HO ",
    "personnelDetails":{
        "address":{
            "state":"Bangalore",
            "country":"Bangalore",
            "displayAddress":"Bangalore",
            "city":"Bangalore",
            "zip":"",
            "phoneNumber":"",
            "line1":"Bangalore",
            "line2":"",
            "line3":""
        },
        "governmentIdNumber":"123",
        "dob":313801200000,
        "maritalStatus":null,
        "gender":50,
        "dateOfJoiningMFI":1315864800000,
        "dateOfJoiningBranch":1315864800000,
        "dateOfLeavingBranch":1315864800000,
        "firstName":"Mifos",
        "middleName":null,
        "secondLastName":null,
        "lastName":"MFI"
    },
    "emailId":null,
    "customFields":[],
    "personnelNotes":[],
    "globalPersonnelNum":"1",
    "age":"31",
    "recentPersonnelNotes":[],
    "preferredLocaleLanguageName":"English - (English) : United Kingdom [en_GB]",
    "preferredLanguageId":1
}

Loans

repay

TYPE

POST

URL

 BASE_URL/account/loan/repay/num-{globalAccountNum}.json

PATH ARGUMENTS

globalAccountNum

REQUEST PARAMS

amount, client

RETURNS

Map:
* status
* clientName
* clientNumber
* loanDisplayName
* paymentDate
* paymentTime
* paymentAmount
* paymentMadeBy
* outstandingBeforePayment
* outstandingAfterPayment

EXAMPLE RESPONSE

{
    "outstandingAfterPayment": "1.0",
    "paymentAmount": "100.0",
    "paymentDate": "2011-09-13",
    "status": "success",
    "paymentTime": "23:24:00.013",
    "clientName": "Client REST API",
    "paymentMadeBy": "mifos",
    "outstandingBeforePayment": "101.0",
    "loanDisplayName": "REST Loan Product A",
    "clientNumber": "0002-000000003"
}

Savings

deposit

TYPE

POST

URL

 BASE_URL/account/savings/deposit/num-{globalAccountNum}.json

PATH ARGUMENTS

globalAccountNum

REQUEST PARAMS

amount, client

RETURNS

Map:
* status
* clientName
* clientNumber
* savingsDisplayName
* paymentDate
* paymentTime
* paymentAmount
* paymentMadeBy
* balanceBeforePayment
* balanceAfterPayment

EXAMPLE RESPONSE

{
    "savingsDisplayName": "Savings A",
    "balanceBeforePayment": "10.0",
    "paymentAmount": "100.0",
    "paymentDate": "2011-09-13",
    "balanceAfterPayment": "110.0",
    "status": "success",
    "paymentTime": "23:25:25.064",
    "clientName": "Client REST API",
    "paymentMadeBy": "mifos",
    "clientNumber": "0002-000000003"
}
  • No labels