Moneylender API Setup and Overview
Moneylender's built-in API functions similarly to other JSON-based financial services APIs across the industry. Submit and request data using HTTPS requests. Request details are mostly supplied through the query string, with some details supplied in the request body. Each URL of the API supports a different operation in Moneylender.
Configuring the Host Computer
Run as Administrator
In order to use the API, the host instance of Moneylender must be run as administrator. You can create a shortcut to "C:\Program Files (x86)\Moneylender 3 Professional\Moneylender3.exe" and then set the shortcut to always start the program as an administrator for extra convenience (right-click the new shortcut, click Properties, click Advanced, check the box for Run as Administrator). If not running as administrator, Moneylender will be closed by Windows as soon as it tries to start listening for HTTPS connections.
Configure SSL Certificate
You need to configure your Portfolio to use a specific port and assign an SSL certificate to use for encryption on the API. The API cannot be accessed through non-encrypted HTTP requests.
You will need to install a certificate in the Machine\Personal certificate store. You can manage your certificates from Window’s built-in certificate manager. Top open the certificate manage, click the Windows button and type “cert”. Click the option “Manage computer certificates”. It’s pretty easy and inexpensive to get a certificate that matches your domain if you don’t already have one – you can also use whatever certificate you already have (such as localhost or a self-signed certificate). I get my web hosting certificates from ssls.com – their cheapest option is perfectly sufficient for use with the Moneylender API.
In general, you'll want the certificate name to match the name your software will use to access the API – for example, “localhost” or “mylenderwebsite.com”. If you will use a certificate that doesn’t perfectly match the hostname used by your software to access the API, you can usually configure your software to proceed in spite of the name mismatch on the certificate. Be sure that your systems are set up so that a malicious user wouldn’t be able to hijack the connection between the API and your software in this case.
Once you have your certificate installed in the machine store under the Personal group, you can use Moneylender to register that certificate to the API port. In Moneylender with your portfolio open, click Portfolio > Portfolio Settings > Network tab. Enable the API, enter the desired port and click “Attach Certificate to API Port”. Select your certificate from the Machine store and click “Choose”. When you click this button, Moneylender will register itself and this certificate to Windows for receiving incoming HTTPS requests.
Check the box to enable the API, and check the box to Automatically Open to the Network so Moneylender will begin listening for API connections as soon as the portfolio opens from now on. Finally, tell Moneylender to start listening for connections from Portfolio > Make Available on Network.
Adding a User Account to Grant the API Access to Your Portfolio
The API will log into Moneylender using a portfolio user account. You manage these from Portfolio > Configure Portfolio Users. Add an account and be sure to apply the required API permissions. The login ID and password you enter for the user account are the login ID and password you’ll use to access the API.
Connecting to the API
At this point, Windows knows to forward HTTPS requests to Moneylender on the API port. You can open a web browser and navigate to the API. For example, https://localhost:18014. If you connect successfully to the API, you’ll see the internal documentation. The documentation explains the function of each URL of the API, and you can use the links to browse all the available URLs.
Moneylender's Database Architecture
Refer to the diagram below for an illustration of the relationships between the different records. Each Loan record has a multitude of Setting records that define the various characteristics of the loan’s terms at various points in time. A basic loan usually consists of the loan record, plus a principal setting, interest setting, payment setting (not to be confused with payment records that denote the receipt of money from the borrower), and a late fee setting. Any loan can have multiple settings of every type. Some settings can overlap each other (such as late fees and other fees) and some settings supersede each other (such as payment settings, interest settings, and escrow charges).
Browse the API's Internal Documentation
We're hosting an instance of the API on our server so you can see what the internal structure looks like. In our instance of the API, you won't have a loginid or password to authenticate and get a token, but you can read all the details of what the API can do.