Show/Hide Toolbars

PerfectApps ® Help Guide

Create a REST Web Service Connection

To integrate USPS® with PerfectApps, create a new REST Web Service Connection:

 

1.Go to the PerfectApps Connection Settings: REST Web Services Connections

2.Click Add Connection to create a new connection.

3.Fill in the connection details:

a.Name: USPS

b.Type: REST Web Service Connection

c.Service URL: https://api.usps.com/

d.Set the connection to Active.

4.Set permissions to allow relevant users to access the USPS connection.

5.Click Apply Changes to save the connection.

 

Define Connection Actions

After creating the USPS connection, define actions for each USPS API endpoint you want to use:

1.Go to the Actions tab within the USPS connection: Defining Connection Actions

2.Click Add Action to create a new action for each endpoint (e.g., token, address).

3.For each action:

a.Name: Provide a descriptive name, such as Generate OAuth Token or Verify Address.

b.Type: Select the appropriate HTTP method (POST for OAuth token, GET for address verification).

c.Service URL: Use the endpoint URL (oauth2/v3/token or /address).

d.Define the Send Parameters by adding fields like grant_type, client_id, client_secret, etc. (Refer to the Postman setup).

e.For Return Parameters, use the Autocomplete feature by copying the response from Postman for each endpoint and pasting it in the Autocomplete JSON box.

4.Click Apply Changes to save each action.

 

Create Fields in PerfectApps

To use the USPS endpoints in an app, create fields for each send and receive parameter:

1.Create Input Fields: Add input fields for parameters required by the USPS OAuth and Address Verification endpoints. These fields include:

a.For OAuth: grant_type, scope, state, client_id, client_secret, and Token.

b.For Address Verification: streetAddress, secondaryAddress, city, state, ZIPCode, ZIPPlus4, and fields for response data (e.g., ResultStreetAddress, ResultCity, DPVConfirmation).

 

Configure the Button to Trigger the OAuth Request

Add a button in the app to generate an OAuth token:

1.Button Configuration: Select the button to trigger the OAuth token request.

2.Connect Command: Add a connect command to the button.

a.Connection: Select the USPS connection.

b.Action: Select the token action.

c.Map Parameters: Map the input fields to the send parameters for the OAuth request (grant_type, client_id, etc.).

3.Store Token: The OAuth token will be stored in the Token field once the connection runs.

 

Configure Button to Trigger Address Verification Request

Add a button in the app to call the Address Verification endpoint:

1.Button Configuration: Select the button to trigger the address verification.

2.Connect Command: Add a connect command to the button.

a.Connection: Select the USPS connection.

b.Action: Select the address action.

c.Map Parameters: Map the input fields to the send parameters for the address verification request.

3.Use Token: Ensure the OAuth token obtained earlier is used as the authorization in the request headers.

 

Test the Integration in PerfectApps

1.When the app first opens, the button configured for OAuth will generate the token and store it in the Token field.

2.The button for Address Verification will use the obtained token and send the request to verify the provided address.

3.The response from USPS will be mapped to the respective fields in the app to display the verified address details.

 

 

Return to: Integrating with USPS