API – Documents

General

Requests to upload documents are handled differently in LoanPro than other API requests. This is because these requests often times involve sending file information in a multi-part form, rather than JSON.

Note: When you pull document information through the API the active property will show 0 for active documents. That is because this property is being used to show whether a document has been archived, so 0 means it has not been archived and is therefore active.

Uploading

Endpoints

The following are the available endpoints for uploading documents:

POST  https://loanpro.simnang.com/api/public/api/1/odata.svc/CustomerDocuments
POST  https://loanpro.simnang.com/api/public/api/1/odata.svc/LoanDocuments

Below is a sample header for uploading documents

Host

loanpro.simnang.com

Referer

https://loanpro.simnang.com/client/app/index.php

User-Agent

Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0

X-NewRelic-ID

VQcEWFBSChAJUlBQAQMC

X-Requested-With

XMLHttpRequest

Accept

*/*

Accept-Encoding

gzip, deflate

Accept-Language

en-US,en;q=0.5

Autopal-Instance-ID

(your id)

Cache-Control

no-cache

Content-Length

57443

Content-Type

multipart/form-data; boundary=---------------------------9867132174374996981330441183

Authentication

Bearer (your API token)

Body

Below is a sample body for uploading a document

-----------------------------9867132174374996981330441183

Content-Disposition: form-data; name="customerId"

6

-----------------------------9867132174374996981330441183

Content-Disposition: form-data; name="sectionId"

9

-----------------------------9867132174374996981330441183

Content-Disposition: form-data; name="upload"; filename="(file name goes here)"

Content-Type: (content type goes here)



(file binary goes here)

-----------------------------9867132174374996981330441183--

The “customerId” is used to determine which customer to attach the document to. In the event you upload a document for a loan, you use “loanId” instead.

“sectionId” is the document section to use (applicable to both customer and loan documents).

The final section is the actual file to send. The name field MUST be “upload” (all lowercase). The Content-Type needs to be provided.

Updating Documents

To update a document, send a PUT request to the url of the document. For Loan documents, it is:

https://loanpro.simnang.com/api/public/api/1/odata.svc/LoanDocuments(id=<id>)

and for customer documents it is:

https://loanpro.simnang.com/api/public/api/1/odata.svc/CustomerDocuments(id=<id>)

In both cases, replace “<id>” with the ID of the document.

Changing Customer visibility

To change the customer visibility of the document, send a PUT request with the body formatted as follows:

{
  "customerVisible": 1,
  "id": 59
}
  • customerVisible – Set to “1” to allow the customer to see the document on the customer website
  • id – The ID of the document being updated

Updating Metadata

To update the metadata of a document, send a PUT request with the body formatted as follows:

{
  "id": 76,
  "sectionId": "5",
  "description": "this is a description",
  "fileName": "test.png"
}
  • id – The ID of the document to update
  • sectionId – The document’s section ID
  • description – The description for the document
  • fileName – The file name for the document

Note: The sectionId must be a valid one. See Create New Loan Document Section or Create New Customer Document Section for help creating new document sections.


How did we do?


Powered by HelpDocs (opens in a new tab)