LoanPro API Overview Part 2

Connecting to the API

General

To connect to LoanPro, you’ll need an HTTP client (an application on your computer that will send HTTP requests). If you want to send requests to the API without writing code, a REST client will work (REST clients are HTTP clients with a graphical user interface and some helpful tools). Some popular REST clients are Postman and Insomnia. Alternately, you could use command-line utilities, such as cURL, the HTTP library that for your chosen programming language, if available. This tutorial will include code samples for a handful of languages, but we’ll also show the raw HTTP requests so that you can translate them to the language of your choice.

If you aren’t using one of our supported languages, we recommend taking some time to understand the structure of an HTTP request so you can understand what is going on in our HTTP samples. Some good resources for this include TutorialsPoint, Udacity, MDN Web Docs and Codecademy. We recommend referring to your HTTP client’s documentation on how to set it up. Many of them have tutorials on how to send a sample request. Once you have your client setup, it’s time to get your API credentials.

Note: LoanPro uses TLS 1.2 to encrypt communications. When selecting an HTTP client make sure it’s compatible with TLS 1.2!

API credentials consist of two pieces: a tenant ID and an API token. To get the tenant ID and API token, you’ll need to log in to the LoanPro user interface. Upon login, If you see a screen similar to the example shown below, you’ll need to click the tenant you want to get access to.

Next, go to Main Menu > Settings > Company > API > Overview. Once there, you should see a page like the example shown below. If so, complete the next two steps, otherwise, skip to step 3.

1. First, click Do it now.

2. You’ll then be presented with a popup similar to the example shown below. Use the drop-down menu to select a user to associate with API Access and actions. Click “Save”.

3. Once your API Access has been configured, you should see a screen similar to the example

To the right you’ll see the API URL. This is the base URL of the LoanPro API, and all endpoints throughout the tutorial will be relative to this URL. You’ll also see the tenant ID and the API Token that you’ll use to access the API. Keep track of these as you will use them to access the API.

Caution: Keep your tenant ID and API token safe! Anyone who has them can access your tenant and either steal or corrupt your data!

Using Credentials

To use your credentials, you’ll need to set some HTTP headers. Most libraries will have a function to do this. REST clients will usually have a headers tab where headers can be set. You’ll need to set the following headers:

Authorization: Bearer <API Token>

Autopal-Instance-ID: <Tenant ID>

const apiToken = '';
const instanceId = '';

const loanproApi = axios.create({
headers: {
'Authorization': `Bearer ${apiToken}`,
'Autopal-Instance-ID': instanceId
}
});

For example, if your API Token is “ABCDEFG1234567” and the Tenant ID 12345, your headers would be:

const apiToken = 'ABCDEFG1234567';
const instanceId = '12345';

const loanproApi = axios.create({
headers: {
'Authorization': `Bearer ${apiToken}`,
'Autopal-Instance-ID': instanceId
}
});

Testing the Connection

To test the connection, send a GET request to the LoanPro server. There should be an easy way to select the request type in your REST client. Send the request to the following endpoint:

https://loanpro.simnang.com/api/public/api/1/tenant.settings(company.date)

This should return a 200 response, the body of which looks like the following:

{
"d": {
"results": [
{
"id": "company.date.format",
"label": "Date Formatting",
"type": "STRING",
"value": "MM/dd/yyyy",
"group": "company.date",
"modified": "0",
"modified_by": "0",
"sequence": 0
}
]
}
}

Congratulations! You’ve just connected to the LoanPro API!

Click here to go to Part 1.


How did we do?


Powered by HelpDocs (opens in a new tab)