Retrieving loan accounts
Description
This web service returns all the loan accounts that belong to a borrower with the payments and charges, or a loan account with its payments and charges given the loan account ID in the URL. If both the borrowerId and loanAccountId are provided, all the loan accounts that belong to a borrower are returned.
Definition
GET https://<domain>/services/apexrest/peer/v1/loanAccounts/*
Parameters
The table given below provides details of the request parameters used by this web service:
Fields | Type | Description |
---|---|---|
borrowerId*1 | String |
|
loanAccountId*1 | String |
|
additionalLoanFields | String | This is used to denote additional loan fields to be queried |
additionalPaymentFields | String | This is used to denote additional payment fields to be queried |
additionalChargeFields | String | This is used to denote additional charge fields to be queried |
1 :At least one of them should be provided.
Error messages
When you post a web service, you can receive the possible error messages as shown in the table below.
Error Code | Error Message | System.Label | Reason | HTTP Status Code |
---|---|---|---|---|
INVALID_INPUT | Account Id is null | ACCOUNT_ID_NULL | You will receive this error if the Borrower Account Id (borrowerId) is not specified in the Request Parameters as well as Loan Account Id (loanAccountId) is not specified in the Request URL. | 400 |
INVALID_INPUT | Unable to find the Account | ACCOUNT_NOT_FOUND | You will receive this error if no record exists in the system for the Borrower Account Id (borrowerId) specified in the Request Parameters | 400 |
INVALID_INPUT | Unable to find the Loan Account | LOAN_ACCOUNT_NOT_FOUND | You will receive this error if no record exists in the system for the Loan Account Id (loanId) specified in the Request URL. | 400 |
API_EXCEPTION | <exception_message> | NA | You will receive this error if any validation fails or any unexpected error occurs during the processing of the request, the system will raise the exception | 500 |
Sample request
The sample request to be sent is as shown below:
GET https://na11.salesforce.com/services/apexrest/peer/v1/loanAccounts?borrowerId=001G000001KY8by&status=Active - Bad Standing
Sample response
The sample response that you will receive is as shown below:
{ "status": "SUCCESS", "response": [ { "minFundingPercentage": 60 } ], "errorMessage": null, "errorCode": "NO_ERROR", "content": [ { "attributes": { "type": "loan__Loan_Account__c", "url": "/services/data/v30.0/sobjects/loan__Loan_Account__c/a1WG00000050ZujMAE" }, "loan__Interest_Accrued_Not_Due__c": 120, "loan__Total_Amount_Paid__c": 0, "loan__Active_Investor__c": true, "loan__Disbursal_Date__c": "2014-06-23", "loan__Loan_Purpose__r": { "attributes": { "type": "loan__Loan_Purpose__c", "url": "/services/data/v30.0/sobjects/loan__Loan_Purpose__c/a1hG0000000JR1tIAG" }, "Name": "Family", "Id": "a1hG0000000JR1tIAG" }, "loan__Principal_Remaining__c": 15000, "loan__Maturity_Date_Current__c": "2015-06-23", "loan__Expected_Disbursal_Date__c": "2014-06-23", "loan__Loan_Status__c": "Active - Bad Standing", "loan__Pay_Off_Amount_As_Of_Today__c": 15120, "loan__Interest_Waived__c": 0, "loan__Pmt_Amt_Cur__c": 1311.77, "loan__Loan_Amount__c": 15000, "loan__Loan_Purpose__c": "a1hG0000000JR1tIAG", "loan__Fees_Remaining__c": 0, "loan__Last_Installment_Date__c": "2015-06-23", "loan__Interest_Remaining__c": 0, "loan__Next_Installment_Date__c": "2014-08-23", "loan__Due_Day__c": 23, "loan__Number_of_Days_Overdue__c": 2, "loan__Pre_Bill_Days__c": 0, "loan__Interest_Rate__c": 9, "loan__Last_Transaction_Timestamp__c": "2014-06-18T13:17:44.000+0000", "loan__Amount_to_Current__c": 1311.77, "loan__Last_Accrual_Date__c": "2014-06-23", "Name": "LAI-00012477", "loan__Frequency_of_Loan_Payment__c": "Monthly", "loan__Next_Due_Generation_Date__c": "2014-08-23", "loan__Write_off_Tolerance_Amount__c": 0, "loan__Accrual_Stop_Indicator__c": false, "Id": "a1WG00000050ZujMAE", "loan__Interest_Calculation_Method__c": "Declining Balance", "loan__Last_Transaction_Type__c": "Disbursal Transaction", "loan__Time_Counting_Method__c": "Month And Days" }, { "attributes": { "type": "loan__Loan_Account__c", "url": "/services/data/v30.0/sobjects/loan__Loan_Account__c/a1WG00000050ZueMAE" }, "loan__Interest_Accrued_Not_Due__c": 120, "loan__Total_Amount_Paid__c": 0, "loan__Active_Investor__c": true, "loan__Disbursal_Date__c": "2014-06-23", "loan__Loan_Purpose__r": { "attributes": { "type": "loan__Loan_Purpose__c", "url": "/services/data/v30.0/sobjects/loan__Loan_Purpose__c/a1hG0000000JR1tIAG" }, "Name": "Family", "Id": "a1hG0000000JR1tIAG" }, "loan__Principal_Remaining__c": 15000, "loan__Maturity_Date_Current__c": "2015-06-23", "loan__Expected_Disbursal_Date__c": "2014-06-23", "loan__Loan_Status__c": "Active - Bad Standing", "loan__Pay_Off_Amount_As_Of_Today__c": 15120, "loan__Interest_Waived__c": 0, "loan__Pmt_Amt_Cur__c": 1311.77, "loan__Loan_Amount__c": 15000, "loan__Loan_Purpose__c": "a1hG0000000JR1tIAG", "loan__Fees_Remaining__c": 0, "loan__Last_Installment_Date__c": "2015-06-23", "loan__Interest_Remaining__c": 0, "loan__Next_Installment_Date__c": "2014-08-23", "loan__Due_Day__c": 23, "loan__Number_of_Days_Overdue__c": 2, "loan__Pre_Bill_Days__c": 0, "loan__Interest_Rate__c": 9, "loan__Last_Transaction_Timestamp__c": "2014-06-18T14:31:48.000+0000", "loan__Amount_to_Current__c": 1311.77, "loan__Last_Accrual_Date__c": "2014-06-23", "Name": "LAI-00012476", "loan__Frequency_of_Loan_Payment__c": "Monthly", "loan__Next_Due_Generation_Date__c": "2014-08-23", "loan__Write_off_Tolerance_Amount__c": 0, "loan__Accrual_Stop_Indicator__c": false, "Id": "a1WG00000050ZueMAE", "loan__Interest_Calculation_Method__c": "Declining Balance", "loan__Last_Transaction_Type__c": "Disbursal Transaction", "loan__Time_Counting_Method__c": "Month And Days" } ] }