AddressValidation class
google.maps.addressValidation.AddressValidation
class
Static class for accessing the AddressValidation APIs.
Access by calling const {AddressValidation} = await google.maps.importLibrary("addressValidation")
.
See Libraries in the Maps JavaScript API.
Static Methods | |
---|---|
|
fetchAddressValidation(request) Parameters:
Return Value:
Promise<AddressValidation> Validates an address. See https://developers.google.com/maps/documentation/javascript/address-validation/validate-address. |
Properties | |
---|---|
|
Type:
Address optional Information about the address itself as opposed to the geocode. |
|
Type:
Geocode optional Information about the location and place that the address geocoded to. |
|
Type:
AddressMetadata optional Other information relevant to deliverability. metadata is not guaranteed to be fully populated for every address sent to the Address Validation API. |
|
Type:
string optional The UUID that identifies this response. If the address needs to be re-validated, this UUID must accompany the new request. |
|
Type:
USPSData optional Extra deliverability flags provided by USPS. Only provided in region US and PR . |
|
Type:
Verdict optional Overall verdict flags |
Methods | |
---|---|
|
toJSON() Parameters: None
Return Value:
Object Converts the AddressValidation class to a JSON object with the same properties. |
AddressValidationRequest interface
google.maps.addressValidation.AddressValidationRequest
interface
Request interface for
.AddressValidation.fetchAddressValidation
Properties | |
---|---|
|
Type:
PostalAddressLiteral The address being validated. Unformatted addresses should be submitted via PostalAddress.addressLines . |
|
Type:
string optional This field must not be set for the first address validation request. If more requests are necessary to fully validate a single address (for example if the changes the user makes after the initial validation need to be re-validated), then each followup request must populate this field with the from the very first response in the validation sequence. |
|
Type:
boolean optional Enables USPS CASS compatible mode. This affects only the field of AddressValidation . Note: for USPS CASS enabled requests for addresses in Puerto Rico, a PostalAddress.regionCode of the address must be provided as "PR", or an PostalAddress.administrativeArea of the address must be provided as "Puerto Rico" (case-insensitive) or "PR". |
Address class
google.maps.addressValidation.Address
class
Details of the post-processed address. Post-processing includes correcting misspelled parts of the address, replacing incorrect parts, and inferring missing parts.
Access by calling const {Address} = await google.maps.importLibrary("addressValidation")
.
See Libraries in the Maps JavaScript API.
Properties | |
---|---|
|
Type:
Array<AddressComponent> The individual address components of the formatted and corrected address, along with validation information. This provides information on the validation status of the individual components. |
|
Type:
string optional The post-processed address, formatted as a single-line address following the address-formatting rules of the region where the address is located. |
|
Type:
Array<string> The types of components that were expected to be present in a correctly formatted mailing address but were not found in the input AND could not be inferred. Components of this type are not present in formatted_address , postal_address , or address_components . An example might be ['street_number', 'route'] for an input like "Boulder, Colorado, 80301, USA". The list of possible types can be found here. |
|
Type:
PostalAddress optional The post-processed address represented as a postal address. |
|
Type:
Array<string> The types of the components that are present in the address_components but could not be confirmed to be correct. This field is provided for the sake of convenience: its contents are equivalent to iterating through the address_components to find the types of all the components where the is not or the flag is not set to true . The list of possible types can be found here. |
|
Type:
Array<string> Any tokens in the input that could not be resolved. This might be an input that was not recognized as a valid part of an address (for example in an input like "123235253253 Main St, San Francisco, CA, 94105", the unresolved tokens may look like ["123235253253"] since that does not look like a valid street number. |
AddressComponent class
google.maps.addressValidation.AddressComponent
class
Represents a single component of an address (ex. street name, city).
Access by calling const {AddressComponent} = await google.maps.importLibrary("addressValidation")
.
See Libraries in the Maps JavaScript API.
Properties | |
---|---|
|