Validating multiple addresses

Introduction

We now provide an API endpoint intended for bulk processing (i.e. batch processing) of address validations. The endpoint can be used to clean up big amounts of addresses to keep up with renamings. Setting the "since"-parameter to the date of the last check makes sure that all necessary renamings will be done.

The requests and responses correspond to those from the documentation under: Uniserv DOCUMENTATION - Validating an address
The differences to the real-time endpoint are:

  1. there are no selections in the responses

  2. the rate-limiting differs Rate-Limiting

We also added a customerAddressId. This provides the option to give every address an unique ID to map the responses to the requests more easily.

Address Validation Batch Real-Time

Endpoint URL Method Content-Type

/location/v1/validate/batch/sync

POST

application/json

This endpoint is intended as an alternative to the default real-time endpoint (i.e. /location/v1/validate) and shares a lot of similarities with the default interface. Each address validation is performed in a separate request to the endpoint. For billing and rate limitation reasons, this batch real-time endpoint is preferable to the default real-time endpoint.

Example

Given is a set of 6 addresses which should be validated using the batch real-time API using curl:

#!/bin/sh
API_KEY="<API_KEY>"
URL="<BASE_URL>/location/v1/validate/batch/sync"

# Address validation request payloads
addresses[0]='{"country": "DE", "postalCode": "13627", "locality": "Berlin", "subLocality": "Charlottenburg-Nord", "street": "Goebelstr.", "houseNumber": "100"}'
addresses[1]='{"country": "DE", "postalCode": "79761", "locality": "Waldshut-Tiengen", "street": "Karl-Benz-Str", "houseNumber":"2a"}'
addresses[2]='{"country": "DE", "postalCode": "82065", "locality": "Baierbrunn", "poBoxNumber": "Posttfach 11 50", "_options": {"addressTypes": ["po-box"]}}'
addresses[3]='{"country": "AT", "postalCode": "null", "locality": "St. Andrä", "street": "Schönweg-St Andrä"}'
addresses[4]='{"country": "DE", "postalCode": "13627", "locality": "München", "subLocality": "", "street": "Göbelstr."}'

# Iterate over all $addresses
for address in "${addresses[@]}"; do
  # Request each $address individually
  curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer ${API_KEY}" -d "${address}" ${URL}
  echo
done
{"resultClass":"A","results":[{"addressType":"delivery","country":"DE","postalCode":"13627","locality":"Berlin","localityAbbreviation":"Berlin","subLocality":"Charlottenburg-Nord","subLocalityAbbreviation":"Charlottenburg-Nord","street":"Goebelstr.","streetAbbreviation":"Goebelstr.","houseNumber":"100"}]}
{"resultClass":"B","results":[{"addressType":"delivery","country":"DE","postalCode":"79761","locality":"Waldshut-Tiengen","localityAbbreviation":"Waldshut-Tiengen","subLocality":"Tiengen","subLocalityAbbreviation":"Tiengen","street":"Karl-Benz-Str.","streetAbbreviation":"Karl-Benz-Str.","houseNumber":"2 A"}]}
{"resultClass":"C","results":[{"addressType":"po-box","country":"DE","postalCode":"82065","locality":"Baierbrunn","localityAbbreviation":"Baierbrunn","localityAddition":"Isartal","poBoxKeyword":"Postfach","poBoxNumber":"1150"}]}
{"resultClass":"D","results":[{"addressType":"delivery","country":"AT","postalCode":"9433","locality":"St. Andrä","localityAbbreviation":"St. Andrä","subLocality":"St. Andrä","subLocalityAbbreviation":"St. Andrä","street":"Sankt Andrä","streetAbbreviation":"St. Andrä"}]}
{"resultClass":"E","results":[{"country":"DE","postalCode":"13627","locality":"München","street":"Göbelstr."}]}

Keep in mind that each line represents a response-line for an individual curl request.