API – Addresses
Introduction
This article explains how to add, update, and delete addresses via the API.
Many entities will require address information, and this information can be added or updated either within the UI or through the API. Often, to set the address for an entity in LoanPro, you will send the address information in the address field of the entity.
Adding New Addresses
Since addresses are tied to customers, they are created when customers are created. To add a new customer address, you will need to send a POST request to the Customer endpoint. You can add an address to the following URL.
POST https://loanpro.simnang.com/api/public/api/1/odata.svc/Customer()
Here is the body of the request.
{
"PrimaryAddress": {
"address1": "100 10th Street",
"address2": null,
"city": "San Francisco",
"state": "geo.state.CA",
"zipcode": "94103",
"country": "company.country.usa",
"geoLat": "37.774570",
"geoLon": "-122.415135",
"active": 1,
"isVerified": 0,
"isStandardized": 0
}
}
Updating Addresses
Now that you know how to add new addresses, let's update an existing one.
To update an existing address, you will need to send a PUT request to the URL of the desired customer. For example, to update a customer's address with the customer ID of 1137, the URL would be as follows.
PUT https://loanpro.simnang.com/api/public/api/1/odata.svc/Customers(1137)
Below is a sample payload for setting the primary address of a customer:
{
"PrimaryAddress": {
"address1": "201 E Randolph St",
"address2": null,
"city": "Chicago",
"state": "geo.state.IL",
"zipcode": "60602",
"country": "company.country.usa",
"geoLat": "41.882648",
"geoLon": "-87.623102",
"verify": false,
"isStandardized": false
"__update": true,
"__id": 2281
}
}
Parameter | Description |
address1 | The street address |
address2 | Any additional street address information (e.g. suite number, apartment number) |
city | The city. In the case of overseas military addresses, this will be a three-letter designation for the branch of the armed forces. APO stands for Army Post Office, and is used for service members in the Army and Air Force. Addresses for Navy ships and installations will use FPO, short for Fleet Post Office. DPO stands for Diplomatic Post Office, the address code for U.S. embassies. |
state | The state, province, or military address designation. States are formatted “geo.state.<STATE CODE>” where <STATE CODE> is the two character abbreviation of the state. See API – Geo Collections. |
zipcode | The ZIP code where the address is located |
country | The country where the address is located For Canada, it is formatted "company.country.can" The United States is formatted as "company.country.usa" |
geoLat | The latitude of the address (optional) |
geoLon | The longitude of the address (optional) |
active | Set to "1" to be able to use the address |
verify | Determines whether the address will be verified (usually through USPS) |
isStandardized | Determines whether the address will be standardized through USPS |
Since this is an update, you will need to include "__update" and "__id" fields within the PrimaryAddress object and outside of it. These tell the system to update the address and update the customer to reflect those changes.
You can update a linked address via the exact same process listed above.
To update an address that has not been linked to a customer, you will need know how to find the ID of the individual address. These ID's cannot be found within the UI, but they can be found by using an API request. There are two ways that you can find the address ID's:
- If you know the customer's ID, you can find the address ID by sending a GET request to the following URL.
GET https://loanpro.simnang.com/api/public/api/1/odata.svc/Customers(id=1147)/PrimaryAddress
- Alternatively, if you don't have a customer ID, you can pull all address ID's by using the following request.
GET https://loanpro.simnang.com/api/public/api/1/odata.svc/Address()
Once you know the address ID, you can update the unlinked address by sending a PUT request to the URL of the specific address like shown below. In this example, our address ID is 3.
PUT https://loanpro.simnang.com/api/public/api/1/odata.svc/Address(3)
Deleting an Address
To delete an address, send a DELETE request to the URL of an address like shown below.
DELETE https://loanpro.simnang.com/api/public/api/1/odata.svc/Address(3)