API – Linking and Unlinking Customers and Loans
Introduction
This article explains how to link and unlink customers through the API. For a general overview of linking and how to do it in the UI, see our article on Account Linking.
Linking a Customer
The request for linking customers to loans works in the following way: the request endpoint includes the loan ID and the request body includes the customer ID. The example below shows how to link customer 112 to a loan with the ID of 35.
PUT https://loanpro.simnang.com/api/1/odata.svc/Loans(35)
Request body to link customer with id 112:
{
"Customers": {
"results": [
{
"__metadata": {
"uri": "/api/1/odata.svc/Customers(id=112)",
"type": "Entity.Customer"
},
"__setLoanRole": "loan.customerRole.secondary"
}
]
}
}
- __metadata – the __metadata for the customer (pull a GET request on the customer to get the metadata)
- __setLoanRole – the role of the customer on the loan (See API Customer Loan Collections)
Unlinking a Customer
To unlink a customer, send a PUT request to the loan.
PUT https://loanpro.simnang.com/api/1/odata.svc/Loans(35)
Request body to unlink customer with id 112:
{
"Customers": {
"results": [
{
"__destroy": true,
"__metadata": {
"uri": "/api/1/odata.svc/Customers(id=112)",
"type": "Entity.Customer"
}
}
]
}
}
- __destroy – set to try to destroy the link relation
- __metadata – the __metadata for the customer (pull a GET request on the customer to get the metadata)