Create a Collector Queue with a CSV File

This request creates a collector queue.

This request is a bit different from the others listed in our documentation:

  • 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.

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 like shown below.

Here's a breakdown of the headers, endpoint, and payload needed to upload the CSV file:

Authorization: Bearer <Token>
Autopal-Instance-Id: <Tenant ID>
Content-Type: multipart/form-data
POST https://loanpro.simnang.com/api/public/api/1/collector-queue/feed/csv/upload
name: upload
upload: YourCSVFileHere.csv

🚧

If you're using Postman to test these requests, the upload field in the payload above needs to be set as 'file' instead of 'text'.

A successful request will provide a response like this one:

{
    "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 required in the 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:

Authorization: Bearer <Token>
Autopal-Instance-Id: <Tenant ID>
Content-Type: application/json
POST 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 the payload above:

FieldDescriptionAvailable Options
titleThis is the title of your Collector Queue.
typeThis determines how loans are selected for the queue. Since you're using a CSV file in this instance, static is the option you will select—you're using a pre-determined (or "static") set of loans.static
strategyThis determines how the loans in the queue will be assigned to the Agent Users who are using it. The tag_team option splits the work evenly between the agent users, and the random option allows you to distribute the work in selected percentages.random
tag_team
feedTypeThis determines how the list is compiled. In this instance, a csv file.
sortByThis determines how the loans in the queue are sorted.none
amountDue
daysPastDue
loanStatusId
followUpDate
promises.DueDate
orderByThis determines if the sortBy field lists the loans in ascending or descending order.asc
desc
fileNameThis is the name of the CSV file the queue is referencing.
AgentsThis object holds the information for the Agent Users assigned to this Collector Queue. Here, you will list the agents' IDs and the percentage of the queue that will be assigned to them IF the strategy field is set to random. The sortBy and orderBy settings will apply to the agents as well.
FeedUploadThis 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",
        "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",
            "fileObjectBucket": "autopal-fandora",
            "status": "validated",
            "statusMessage": "Success",
            "rowCount": 3,
            "userId": 9427,
            "FileAttachment": {
                "__deferred": {
                    "uri": "LoanCollectorQueueFeedUploads(6)/FileAttachment"
                }
            }
        },
        "WorkQueues": {
            "__deferred": {
                "uri": "LoanCollectorQueues(10)/WorkQueues"
            }
        },
        "AssignedWorkQueues": {
            "__deferred": {
                "uri": "LoanCollectorQueues(10)/AssignedWorkQueues"
            }
        }
    }
}

Database

For information regarding collector queue database tables, see the following articles: