Skip to content

Latest commit

 

History

History
176 lines (130 loc) · 7.02 KB

AddressValidationApi.md

File metadata and controls

176 lines (130 loc) · 7.02 KB

shippingapi.Api.AddressValidationApi

All URIs are relative to https://shipping-api-sandbox.pitneybowes.com/shippingservices

Method HTTP request Description
VerifyAddress POST /v1/addresses/verify Address validation
VerifyAndSuggestAddress POST /v1/addresses/verify-suggest Address Suggestion

VerifyAddress

Address VerifyAddress (Address address, bool? xPBUnifiedErrorStructure = null, bool? minimalAddressValidation = null)

Address validation

Address validation verifies and cleanses postal addresses within the United States to help ensure packages are rated accurately and shipments arrive at their final destinations on time.

Example

using System.Collections.Generic;
using System.Diagnostics;
using shippingapi.Api;
using shippingapi.Client;
using shippingapi.Model;

namespace Example
{
    public class VerifyAddressExample
    {
        public static void Main()
        {
            Configuration.Default.BasePath = "https://shipping-api-sandbox.pitneybowes.com/shippingservices";
            // Configure OAuth2 access token for authorization: oAuth2ClientCredentials
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AddressValidationApi(Configuration.Default);
            var address = new Address(); // Address | Address object that needs to be validated.
            var xPBUnifiedErrorStructure = true;  // bool? | Set this to true to use the standard [error object](https://shipping.pitneybowes.com/reference/error-object.html#standard-error-object) if an error occurs. (optional)  (default to true)
            var minimalAddressValidation = true;  // bool? | When set to true, the complete address (delivery line and last line) is validated but only the last line (city, state, and postal code) would be changed by the validation check. (optional) 

            try
            {
                // Address validation
                Address result = apiInstance.VerifyAddress(address, xPBUnifiedErrorStructure, minimalAddressValidation);
                Debug.WriteLine(result);
            }
            catch (ApiException e)
            {
                Debug.Print("Exception when calling AddressValidationApi.VerifyAddress: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

Name Type Description Notes
address Address Address object that needs to be validated.
xPBUnifiedErrorStructure bool? Set this to true to use the standard error object if an error occurs. [optional] [default to true]
minimalAddressValidation bool? When set to true, the complete address (delivery line and last line) is validated but only the last line (city, state, and postal code) would be changed by the validation check. [optional]

Return type

Address

Authorization

oAuth2ClientCredentials

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 successful operation -
405 Invalid input -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

VerifyAndSuggestAddress

AddressSuggestionResponse VerifyAndSuggestAddress (string returnSuggestions, AddressVerifySuggest addressVerifySuggest, bool? xPBUnifiedErrorStructure = null)

Address Suggestion

This operation returns suggested addresses. Use this if the Address Validation API call has returned an error.

Example

using System.Collections.Generic;
using System.Diagnostics;
using shippingapi.Api;
using shippingapi.Client;
using shippingapi.Model;

namespace Example
{
    public class VerifyAndSuggestAddressExample
    {
        public static void Main()
        {
            Configuration.Default.BasePath = "https://shipping-api-sandbox.pitneybowes.com/shippingservices";
            // Configure OAuth2 access token for authorization: oAuth2ClientCredentials
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AddressValidationApi(Configuration.Default);
            var returnSuggestions = returnSuggestions_example;  // string | To return suggested addresses, set this to true. (default to "true")
            var addressVerifySuggest = new AddressVerifySuggest(); // AddressVerifySuggest | Address object that needs to be validated.
            var xPBUnifiedErrorStructure = true;  // bool? | Set this to true to use the standard [error object](https://shipping.pitneybowes.com/reference/error-object.html#standard-error-object) if an error occurs. (optional)  (default to true)

            try
            {
                // Address Suggestion
                AddressSuggestionResponse result = apiInstance.VerifyAndSuggestAddress(returnSuggestions, addressVerifySuggest, xPBUnifiedErrorStructure);
                Debug.WriteLine(result);
            }
            catch (ApiException e)
            {
                Debug.Print("Exception when calling AddressValidationApi.VerifyAndSuggestAddress: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

Name Type Description Notes
returnSuggestions string To return suggested addresses, set this to true. [default to "true"]
addressVerifySuggest AddressVerifySuggest Address object that needs to be validated.
xPBUnifiedErrorStructure bool? Set this to true to use the standard error object if an error occurs. [optional] [default to true]

Return type

AddressSuggestionResponse

Authorization

oAuth2ClientCredentials

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 successful operation -
405 Invalid input -

[Back to top] [Back to API list] [Back to Model list] [Back to README]