USPS Address Verify Data Flow Template

USPSverifyaddress.png

Overview

This Data Flow template is made up of six Data Operations that allow app builders to use a USPS API with an XML payload to verify an address.

In Connection Builder, Data Flow templates can be found with pre-populated sample data. However, to meet the requirements of their Journey, app builders should perform the necessary adjustments, such as adding other Data Ops.

Data Operations

This Data Flow contains eight parts:

Inputs

The Start pane keeps track of the inputs required by the Data Flow. 

  • Sample Inputs:
    • address Variable of type Text
    • address_2 Variable of type Text
    • city Variable of type Text
    • state_code Variable of type Text
    • zip_5 Variable of type Text
    • zip_4 Variable of type Text

  • Transform Expression: Airscript expression to format the XML payload for the HTTP Request.
  • Output Format: Variable
  • Type: Text
  • Run Results: payload output Variable of type Text that is automatically created to hold the result of this Operation.

  • Service: no service selected
  • Method: GET - to retrieve data
  • URL: This Airscript expression requires an account with the USPS API.
  • Allow non-compliant HTTP headers: box unchecked
  • Content-Type: “txt/xml”
  • Headers: no parameter set
  • Query Parameters: HTTP Parameter 
    • Field Name: API
    • Value: Verify
    • Field Name: MXL
    • Value: Payload
  • Form Parameters: no parameter set
  • Had paging?: box unchecked
  • Run Results: AirData Variables of type Any that automatically created to hold the results of this Operation. 
    • result
    • rawResult
    • request

Transform Data Operation

  • Transform Expression: rawResult.Body - Airscript expression to get the result of the HTTP request as an XML output.
  • Output Format: Variable
  • Type: Text
  • Run Results: xml_output Variable of type Text that is automatically created to hold the result of this Operation.

  • Input Value (String): xml_output - Airscript expression to convert a Text value with XML into JSON.
  • Run Results: json_output Variable of type Any that is automatically created to hold the result of this Operation.

Transform Data Operation

  • Transform Expression: Airscript expression to parse through the JSON.
  • Output Format: Variable
  • Type: Any
  • Run Results: address_output Variable of type Any that is automatically created to hold the result of this Operation.

Transform Data Operation

  • Transform Expression: Airscript expression to format the output to pass as an output of the data flow.
  • Output Format: Variable
  • Type: Any
  • Run Results: output Variable of type Any that is automatically created to hold the result of this Operation.

Output

The End step is where variables from the Data Flow can be used as an output..

  • output Return Value of type Any

Use Cases

  • Allow app builders to verify an address using the USPS API of shipping and mailing services.