The Address Validation Street Level API can be used to. check addresses against the United States Postal Service database of valid addresses in the U.S. and Puerto Rico. # Reference - <a href="proxy.php?url=https%3A%2F%2Fgithub.com%2F%3Ca+href%3D"https://developer.ups.com/api/reference/addressvalidation/appendix%5C" rel="nofollow">https://developer.ups.com/api/reference/addressvalidation/appendix\" target="_blank" rel="noopener">Appendix - <a href="proxy.php?url=https%3A%2F%2Fgithub.com%2F%3Ca+href%3D"https://developer.ups.com/api/reference/addressvalidation/business-rules%5C" rel="nofollow">https://developer.ups.com/api/reference/addressvalidation/business-rules\" target="_blank" rel="noopener">Business Rules - <a href="proxy.php?url=https%3A%2F%2Fgithub.com%2F%3Ca+href%3D"https://developer.ups.com/api/reference/addressvalidation/errors%5C" rel="nofollow">https://developer.ups.com/api/reference/addressvalidation/errors\" target="_blank" rel="noopener">Errors - <a href="proxy.php?url=https%3A%2F%2Fgithub.com%2F%3Ca+href%3D"https://developer.ups.com/api/reference/addressvalidation/faq%5C" rel="nofollow">https://developer.ups.com/api/reference/addressvalidation/faq\" target="_blank" rel="noopener">FAQ
Try out UPS APIs with example requests using Postman. Explore API documentation and sample applications through GitHub.
<a href="proxy.php?url=https%3A%2F%2Fgithub.com%2F%3Ca+href%3D"https://god.gw.postman.com/run-collection/29542085-f2cd7176-bd05-48ea-bb72-b359a11cff09?action=collection%2Ffork&source=rip_markdown&collection-url=entityId%3D29542085-f2cd7176-bd05-48ea-bb72-b359a11cff09%26entityType%3Dcollection%26workspaceId%3D7e7595f0-4829-4f9a-aee1-75c126b9d417%5C" rel="nofollow">https://god.gw.postman.com/run-collection/29542085-f2cd7176-bd05-48ea-bb72-b359a11cff09?action=collection%2Ffork&source=rip_markdown&collection-url=entityId%3D29542085-f2cd7176-bd05-48ea-bb72-b359a11cff09%26entityType%3Dcollection%26workspaceId%3D7e7595f0-4829-4f9a-aee1-75c126b9d417\" target="_blank" rel="noopener noreferrer"> <img src="proxy.php?url=https%3A%2F%2Fgithub.com%2F%3Ca+href%3D"https://run.pstmn.io/button.svg%5C" rel="nofollow">https://run.pstmn.io/button.svg\" alt="Run In Postman" style="width: 128px; height: 32px;"> <a href="proxy.php?url=https%3A%2F%2Fgithub.com%2F%3Ca+href%3D"https://github.com/UPS-API%5C">https://github.com/UPS-API\" target="_blank" rel="noopener noreferrer"> <img src="proxy.php?url=https%3A%2F%2Fgithub.com%2F%3Ca+href%3D"https://www.ups.com/assets/resources/webcontent/images/gitHubButton.svg%5C" rel="nofollow">https://www.ups.com/assets/resources/webcontent/images/gitHubButton.svg\" alt="Open in GitHub " style="width: 128px; height: 32px;">This PHP package is automatically generated by the Swagger Codegen project:
- API version:
- Package version: 1.0.9
- Build package: io.swagger.codegen.v3.generators.php.PhpClientCodegen
PHP 5.5 and later
To install the bindings via Composer, add the following to composer.json:
{
"repositories": [
{
"type": "git",
"url": "https://github.com/abantecart/ups-address-validation.git"
}
],
"require": {
"abantecart/ups-address-validation": "*@dev"
}
}
Then run composer install
Download the files and include autoload.php:
require_once('/path/to/AddressValidation/vendor/autoload.php');To run the unit tests:
composer install
./vendor/bin/phpunit
Please follow the installation procedure and then run the following:
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure OAuth2 access token for authorization: OAuth2
$config = UPS\AddressValidation\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new UPS\AddressValidation\Request\AddressValidationApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);
$body = new \UPS\AddressValidation\AddressValidation\XAVRequestWrapper(); // \UPS\AddressValidation\AddressValidation\XAVRequestWrapper | Generate sample code for popular API requests by selecting an example below. To view a full sample request and response, first click \"Authorize\" and enter your application credentials, then populate the required parameters above and click \"Try it out\".
$requestoption = 56; // int | Identifies the optional processing to be performed. If not present or invalid value then an error will be sent back. Valid values: - 1 - Address Validation - 2 - Address Classification - 3 - Address Validation and Address Classification. For a list of valid values, refer to Address Validation API Supported Countries or Territories in the Appendix.
$version = "version_example"; // string | Identifies the version of the API. Valid values: - v2
$regionalrequestindicator = "regionalrequestindicator_example"; // string | Valid values: True or False. If True, either the region element or any combination of Political Division 1, Political Division 2, PostcodePrimaryLow and the PostcodeExtendedLow fields will be recognized for validation in addition to the urbanization element. If False or no indicator, street level address validation is provided
$maximumcandidatelistsize = 56; // int | Valid values: 0 – 50 The maximum number of Candidates to return for this request. If not provided, the default size of 15 is returned.
try {
$result = $apiInstance->addressValidation($body, $requestoption, $version, $regionalrequestindicator, $maximumcandidatelistsize);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling AddressValidationApi->addressValidation: ', $e->getMessage(), PHP_EOL;
}
// Configure OAuth2 access token for authorization: OAuth2
$config = UPS\AddressValidation\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new UPS\AddressValidation\Request\AddressValidationApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);
$body = new \UPS\AddressValidation\AddressValidation\XAVRequestWrapper(); // \UPS\AddressValidation\AddressValidation\XAVRequestWrapper | Generate sample code for popular API requests by selecting an example below. To view a full sample request and response, first click \"Authorize\" and enter your application credentials, then populate the required parameters above and click \"Try it out\".
$requestoption = 56; // int | Identifies the optional processing to be performed. If not present or invalid value then an error will be sent back. Valid values: - 1 - Address Validation - 2 - Address Classification - 3 - Address Validation and Address Classification. For a list of valid values, refer to Address Validation API Supported Countries or Territories in the Appendix.
$deprecated_version = "deprecated_version_example"; // string | Identifies the version of the API. Valid values: - v1
$regionalrequestindicator = "regionalrequestindicator_example"; // string | Valid values: True or False. If True, either the region element or any combination of Political Division 1, Political Division 2, PostcodePrimaryLow and the PostcodeExtendedLow fields will be recognized for validation in addition to the urbanization element. If False or no indicator, street level address validation is provided
$maximumcandidatelistsize = 56; // int | Valid values: 0 – 50 The maximum number of Candidates to return for this request. If not provided, the default size of 15 is returned.
try {
$result = $apiInstance->deprecatedAddressValidation($body, $requestoption, $deprecated_version, $regionalrequestindicator, $maximumcandidatelistsize);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling AddressValidationApi->deprecatedAddressValidation: ', $e->getMessage(), PHP_EOL;
}
?>All URIs are relative to https://wwwcie.ups.com/api
| Class | Method | HTTP request | Description |
|---|---|---|---|
| AddressValidationApi | addressValidation | POST /addressvalidation/{version}/{requestoption} | Address Validation |
| AddressValidationApi | deprecatedAddressValidation | POST /addressvalidation/{deprecatedVersion}/{requestoption} | Address Validation |
- CandidateAddressClassification
- CandidateAddressKeyFormat
- CommonErrorResponse
- ErrorMessage
- ErrorResponse
- RequestTransactionReference
- ResponseAlert
- ResponseResponseStatus
- ResponseTransactionReference
- XAVRequest
- XAVRequestAddressKeyFormat
- XAVRequestRequest
- XAVRequestWrapper
- XAVResponse
- XAVResponseAddressClassification
- XAVResponseCandidate
- XAVResponseResponse
- XAVResponseWrapper
- Type: OAuth
- Flow: application
- Authorization URL:
- Scopes: