API – Create a Collector Queue with a CSV File
Introduction
This request is a bit different from our others listed here in our documentation. Here's what you need to know about creating collector queues:
- This request requires two steps instead of one (pretty exciting, right?). To create a collector queue via the API, you will need to send two requests:
- A request to upload the CSV to LoanPro's Loan Management System (LMS)
- A request to create the queue with the CSV file you uploaded
- Most of our docs on this site allow you to try the requests yourself; however, this one doesn't quite work that way. We'll provide you the information for trying this yourself in your own REST client, though.
- Since one of these requests uploads a file, your headers will change. Pay close attention to how the requests differ from each other.
For an example of how collector queues work within the UI, take a look at our Collector Queue 101 article.
You can also read about this topic on our site dedicated to API documentation. Click the button below to see this information as well as instructions to all of our other API requests.
How To
Like we mentioned, creating a collector queue via the API requires two steps.
Step One - Upload the CSV
The first step in this process is uploading the CSV file that contains the loans that will be added to the queue. This request needs to be in the multipart/form-data format. Thus, make sure to update your Content-Type
header.
HEADERS:
Autopal-Instance-Id: 5200243
Authorization: Bearer e0fc048f37e3f59f67309d10ef5f49764d8e6b3f
Content-Type: multipart/form-data
upload
field in the payload above needs to be set as 'file' instead of 'text'.POST https://loanpro.simnang.com/api/public/api/1/collector-queue/feed/csv/upload
Here is an example of what the payload for this request should look like:
This request uses the multipart/form-data format. Your request will include the following key:value pairs.
name: upload
upload: YourCSVFileHere.csv
A successful request will result in a response similar to the following:
{
"d": {
"id": "6", // 👈 You'll need this ID.
"fileName": "CollectorQueueList_62e2f63d05e41d6e5d5e8afe4f44447805f0b850e4de8.csv",
"uploadUrl": "https://autopal-fandora.s3.amazonaws.com/tenants/5200243/fileAttachments/collector_queue_feed_uploads/CollectorQueueList_62e2f63d05e41d6e5d5e8afe4f44447805f0b850e4de8.csv",
"customFileName": "phplsKoEA",
"mime": "text/csv",
"status": "validated",
"rowCount": 3
}
}
Your response will include an id
field. The ID listed in this field is going to be used in your next request, so make sure to keep track of it.
Step Two - Create the Collector Queue
Next, you will create the Collector Queue itself. This request is formatted like many of our other requests, and you'll need to use the typical LMS headers here. Here's how the request is built:
HEADERS:
Authorization: Bearer e0fc048f37e3f59f67309d10ef5f49764d8e6b3f
Autopal-Instance-Id: 5200243
Content-Type: application/json
PUT https://loanpro.simnang.com/api/public/api/1/odata.svc/LoanCollectorQueues
{
"title": "Collector Queue",
"type": "static",
"strategy": "random",
"feedType": "csv",
"sortBy": "none",
"orderBy": "",
"fileName": "CollectorQueueList.csv",
"Agents": {
"results": [
{
"agentId": 2657,
"sortBy": "daysPastDue",
"orderBy": "descending",
"workPercentage": 70
},
{
"agentId": 2658,
"sortBy": "daysPastDue",
"orderBy": "descending",
"workPercentage": 30
}
]
},
"FeedUpload": {
"__id": "6" // 👈 This is the ID you received from the previous request.
}
}
Here's a breakdown of the fields included in this payload:
Field | Description | Available Options |
title | This is the title of your Collector Queue. | |
type | This determines how loans are selected for the queue. Since you're using a CSV file in this instance, | static |
strategy | This determines how the loans in the queue will be assigned to the Agent Users who are using it. The | random tag_team |
feedType | This determines how the list is compiled. In this instance, | |
sortBy | This determines how the loans in the queue are sorted. | none amountDue daysPastDue loanStatusId followUpDate promises.DueDate |
orderBy | This determines if the | asc desc |
fileName | This is the name of the CSV file the queue is referencing. | |
Agents | This object holds the information for the Agent Users assigned to this Collector Queue. Here, you will list the agent's ID and the percentage of the queue will be assigned to them IF the | |
FeedUpload | This object holds the ID of the CSV file from the previous request. |
A successful request will result in the creation of a collector queue, and the system will provide a response like the following:
{
"d": {
"__metadata": {
"uri": "http://loanpro.simnang.com/api/public/api/1/odata.svc/LoanCollectorQueues(id=10)",
"type": "Entity.LoanCollectorQueue"
},
"id": 10,
"title": "Collector Queue Test",
"type": "static",
"strategy": "random",
"feedType": "csv",
"feedContent": null,
"loanCount": 3,
"status": "pendingInitialization",
"statusMessage": null,
"sortBy": "none",
"orderBy": "",
"userId": 9427,
"created": "/Date(1659043330)/",
"started": null,
"completed": null,
"agentsList": "John Doe",
"callbackUrl": null,
"workInProgress": 0,
"workCompleted": 0,
"timeSpent": 0,
"Agents": {
"results": [
{
"__metadata": {
"uri": "http://loanpro.simnang.com/api/public/api/1/odata.svc/LoanCollectorQueueAgents(id=10)",
"type": "Entity.LoanCollectorQueueAgent"
},
"id": 10,
"collectorQueueId": 10,
"agentId": 9427,
"agentFullName": "John Doe",
"workPercentage": 100,
"sortBy": "daysPastDue",
"orderBy": "descending"
}
]
},
"FeedUpload": {
"__metadata": {
"uri": "http://loanpro.simnang.com/api/public/api/1/odata.svc/LoanCollectorQueueFeedUploads(id=6)",
"type": "Entity.LoanCollectorQueueFeedUpload"
},
"id": 6,
"collectorQueueId": 10,
"fileObjectKey": "tenants/5200243/fileAttachments/collector_queue_feed_uploads/CollectorQueueList_62e2f63d05e41d6e5d5e8afe4f44447805f0b850e4de8.csv",
"fil
Database
For information on collector queue database tables, see the following articles: