This article describes a set of steps that can be used to complete an address validation of a contact through CostGuard Web APIs.
Determine Customer ID
CostGuard Web APIs use internal IDs to identify resources which are generally not known externally. To determine the internal ID externally known information will need to be used to look up the internal ID. For customers the most common way of accomplishing this is through a customer account search using the Customer Management service.
Example Call: https://api.idibilling.com/CustomerManagement/2x/{environment}/api/customer/accountSearch?$filter=AccountNumber eq ‘{AccountNumber}’
- environment: Name of the environment you are working in.
- AccountNumber: Account number assigned to the customer
Important Response Information:
- CustomerID: This field is the customer internal ID for future API Calls.
Get the Contact Type
The information to determine what type of validation the contact requires is stored on the contact type. The contact type is defined on a customer at the time of creation. This determines what type of validation will occur when the address is validated. Querying the Contact Type oData will provide the AddressValidationTypeID which is required to make an address validation call.
API: Data Service – Contact Type
Content-Type: application/json
Example Call: https://api.idibilling.com/data/1x/{environment}/CoreDataService/ContactType()?$filter=Description eq ‘{Description}’
- environment: Name of the environment you are working in.
- Description: The Description of the contact type you are attempting to lookup
Important Response Information:
- AddressValidationTypeID: This ID is required for the next step to validate the address.
Validate the Address
The next step is to attempt to validate the address. Using the AddressValidationTypeID found in the previous step along with the complete address information you can create a validation request.
API: Address Validation Management – Validate Address
Content-Type: application/json
Example Call: https://api.idibilling.com/AddressValidationManagement/2x/{environment}/api/validateAddress
- environment: Name of the environment you are working in.
Important Response Information:
- ActualValidationType: This may be different than the requested if incomplete information was provided or the address could not be validated using the requested type.
- IsValidated: True or False depending on if the address was successfully validated using.
Translate the result
The response back from the AddressValidation API needs to be translated to the CustomerService API when modifying a contacts address information. Take the AddressValidationManagement result and convert it to the AddressValidationInformation object and contact info found under the CustomerService Modify Customer operation.
Example 2x Response:
{
"actualValidationType": "USPS",
"addressStandardized": [
{
"address":
{
"City": "Rochester",
"Country": "USA",
"County": "Monroe",
"Latitude": 40.020000,
"Longitude": -105.240000,
"Name": "Justin Winslow",
"State": "NY",
"Street1": "445 Mount Eden Road",
"Street2": "Apt 104",
"Street3": "",
"ZipCode": 14653
},
"fipsCode": "0801307850",
"taxSpecialDistricts": [
{
"code": "01PPJ00124"
}]
}
],
"attemptedValidationType": "USPS",
"errorCode": "",
"excludeReasonID": "",
"failureCount": "",
"isPOBox": true,
"isValidated": true,
"requestedValidationType": "USPS",
"validationDate": "2019-05-01T18:00:00.000Z"
}
Translate to 1x Request to pass to the Customer Service (AddressValidationInformation object example below)
Important Information:
- AddressValidationType: When using Core Logic you need to convert the type from “Core Logic” to “Proxix” due to the naming change from 1x to 2x service.
Modify the Customer
Once the validation information has been determined you need to update the customer contact address with the result. The result from the AddressValidationManagement service needs to be transformed into the CustomerService address structure which is a slightly different format.
API: Customer Service – Modify Customer
Content-Type: application/soap+xml; charset=utf-8; action=\”https://webservices.idibilling.com/customer/ModifyCustomer”
Example Call: https://api.idibilling.com/customercare/1x/{environment}/
AuthToken
USPS
USPS
2019-05-01T00:00:00
Rochester
IDI
542178
2
USA
Monroe
helpdesk@idibilling.com
Work
Justin
Winslow
40.020000
-105.240000
M
5854536500
Work
NY
445 mount Eden Road
Apt 104
14653
AuthKey
{CustomerID}
- environment: Name of the environment you are working in.
- CustomerID: Internal customer ID retrieved using Determine Service ID
Example Response (Extra information excluded from Response):
123456
1
Residential
Monthly on the 7th
2
Justin Winslow
Billable
USPS
231</ AddressValidationLogID >
0
USPS
0229054150
01PPJ00484
2019-05-01T00:00:00
123
Primary Customer Contact
1
1