Pergunta

I am using UPS API for address validation. I am very new to this API and have just started learning.

  1. I want to validate an address based on only zipcode i.e. I don't want to suppy the State name. It is not working in Test Integration environment. Any help?

  2. I want to validate address using only Street Address and Zipcode. I don't want to supply State & City name. Is that possible? So far not working.

If I provide both State & Zipcode it is working nice.

Foi útil?

Solução

How committed are you to the UPS API? My experience is that if they don't have it in the API already, it won't happen soon. There are other APIs available that will let you verify an address based on only the address and the ZIP code. typically, it is not necessary to provide a city or state if you have the correct ZIP code. The minimum required for address validation is street address and zip code or street address and city/state. how many addresses to need to verify each month? If you don't need a whole lot, there are a number of free APIs available. National address server is one, SmartyStreets.com is another. (I work for SmartyStreets.com.)

Outras dicas

If you provide blank values for PoliticalDivision1 and PoliticalDivision2 the result back should include the city and state. You must still provide a valid address.

In a C++ application the following XML input used in street level address validator UPS API. Please use appropriate licence number, user id and password.

<?xml version=\"1.0\"?>
<AccessRequest   xml:lang=\"en-US\"><AccessLicenseNumber>{LicenceNo}</AccessLicenseNumber><UserId>{UserId}</UserId><Password>{Passwd}</Password></AccessRequest>
<?xml version=\"1.0\"?>
<AddressValidationRequest xml:lang=\"en-US\">
  <Request><TransactionReference><CustomerContext>Your Test Case Summary Description</CustomerContext><XpciVersion>1.0</XpciVersion></TransactionReference><RequestAction>XAV</RequestAction><RequestOption>3</RequestOption>
  </Request>
  <AddressKeyFormat><AddressLine>608 E. Evergreen Rd</AddressLine><PoliticalDivision2>LEBANON</PoliticalDivision2>    <PoliticalDivision1>PA</PoliticalDivision1><PostcodePrimaryLow>17042</PostcodePrimaryLow><CountryCode>US</CountryCode> </AddressKeyFormat>
</AddressValidationRequest>

and following output received.

<?xml version=\"1.0\"?>
<AddressValidationResponse>
  <Response>
    <TransactionReference><CustomerContext>Your Test Case Summary Description</CustomerContext> <XpciVersion>1.0</XpciVersion></TransactionReference> <ResponseStatusCode>1</ResponseStatusCode><ResponseStatusDescription>Success</ResponseStatusDescription>
  </Response>
  <ValidAddressIndicator/>
  <AddressClassification><Code>1</Code><Description>Commercial</Description></AddressClassification>
  <AddressKeyFormat><AddressClassification><Code>1</Code><Description>Commercial</Description></AddressClassification><AddressLine>608 E EVERGREEN RD</AddressLine><Region>LEBANON PA 17042-7925</Region><PoliticalDivision2>LEBANON</PoliticalDivision2><PoliticalDivision1>PA</PoliticalDivision1><PostcodePrimaryLow>17042</PostcodePrimaryLow><PostcodeExtendedLow>7925</PostcodeExtendedLow><CountryCode>US</CountryCode></AddressKeyFormat>
</AddressValidationResponse>

Another potential solution besides the UPS API is the Service Objects address validation web service. Full disclosure, I work for Service Objects, but the web service objectively fits your needs.

It can process addresses with just the address1 and zipcode fields. The web service can validate the information, append the city, state, zip+4, note any corrections/changes, and provide a Delivery Point Validation (DPV) code indicating the address's deliverability. Below is an example input and output showing the actual service response.

If you are interested in trying out the API a free trial key is available for testing. You want to get more information about the nitty gritty technical details check out the Developer Guide

Example Input:

Address1: 27 E Cota St Ste 500

Zipcode: 93101

{
  "Addresses":[
      {
        "Address1":"27 E Cota St Ste 500",
        "Address2":"",
        "City":"Santa Barbara",
        "State":"CA",
        "Zip":"93101-7602",
        "IsResidential":"false",
        "DPV":"1",
        "DPVDesc":"Yes, the input record is a valid mailing address",
        "DPVNotes":"26,28,39",
        "DPVNotesDesc":"The input address matched the ZIP+4 record,The input address matched the DPV record,Highrise apartment\/office building address",
        "Corrections":"10,23",
        "CorrectionsDesc":"City change,State change",
        "BarcodeDigits":"931017602254",
        "CarrierRoute":"C006",
        "CongressCode":"24",
        "CountyCode":"083",
        "CountyName":"Santa Barbara",
        "FragmentHouse":"27",
        "FragmentPreDir":"E",
        "FragmentStreet":"Cota",
        "FragmentSuffix":"St",
        "FragmentPostDir":"",
        "FragmentUnit":"Ste",
        "Fragment":"500",
        "FragmentPMBPrefix":"",
        "FragmentPMBNumber":""
      }
  ],
  "IsCASS":true
}
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top