API – Custom Forms
This article will describe how to pull a custom form from LMS directly with the API.
Pulling a Custom Form with the LoanPro API
The process for generating a custom form is an asynchronous job that happens server-side on the LoanPro system. For that reason, it involves submitting an HTTP request to initiate the generation of the form; then, a periodic query is made to ask LoanPro if the form generation is complete. Most forms will only take about a second to generate, but some may take longer depending on the size of the form or if multiple forms were generated at once.
Initiating the Form Generation
To initiate the form generation, you will use the following endpoint:
(Note that "935" in this example is the ID of the loan for which you are generating a form for.)
The payload will include a list of forms to be generated by the form ID.
For a single form, use something like listed in the example below. In this case, the custom form with ID 3 will be generated.
For multiple forms, use something like the next example.
Checking Form Download Status
To query whether the form generation is complete, you can use the following OData endpoint:
GET https://loanpro.simnang.com/api/public/api/1/odata.svc/DataDumps?$filter=entityType eq ‘Entity.CustomForm_935′ and created gt datetime’2021-10-20 16:47:50’
To learn more about endpoint parameters, read our API – Paginating Results article.
You will receive a standard OData query result. In the result below, you can see the result of 2 forms that were generated because we submitted one with a single form and then one with 2 forms merged.
“createUser”: “Temp User”
“createUser”: “Temp User”
What you want to look for is the “status” property. It will read, “dataDumpProcess.status.complete” when the form has completed generating. Additionally, prior to the form being completed, the “fileName” and “url” properties will be null. Once the form is generated, you can use the “url” provided to download the PDF from our Amazon S3 cloud storage service.
Many of our articles use StackBlitz examples like this. These examples are like a window into a REST client right here in your browser. The window is divided into two sides. Developers can use info in the editor on the left side when configuring your API integration, and the right side shows a preview of a REST client. Click 'Preview' on the bottom, and you'll only see the REST client.
The entire request is set up and connected to a demo API tenant in LMS. Just scroll down and click 'send' and you should get a 200 response. If you want to get some practice with error codes, try editing the endpoint, headers, method and payload to see what responses you get.