Ready to get started?

Learn more about CData Cloud Hub or sign up for a free trial:

Learn More

Create Apps from USPS Data in Qlik Sense Cloud

Use the CData Cloud Hub to create an OData API for USPS data and build apps from live USPS data in Qlik Sense Cloud.

Qlik Sense Cloud allows you to create and share data visualizations and interact with information in new ways. The CData Cloud Hub creates a virtual database for USPS and can be used to generate an OData API (natively consumable in Qlik Sense Cloud) for USPS. By pairing Qlik Sense Cloud with the CData Cloud Hub, you get true cloud-to-cloud connectivity to all of your SaaS and cloud-based Big Data and NoSQL sources — no need to migrate your data or write your integrations. Simply connect to the Cloud Hub from Qlik Sense Cloud as you would any other REST service and get instant, live access to your USPS data.

In this article, we walk through two connections:

  1. Connecting to USPS in the Cloud Hub
  2. Connecting to the Cloud Hub from Qlik Sense Cloud to create a model and build a simple dashboard

Configure Cloud Hub to Connect to USPS

To connect to USPS data from Qlik Sense Cloud, you need to configure USPS access from your Cloud Hub instance. This means creating a user, connecting to USPS, adding OData endpoints, and (optionally) configuring CORS.

Add a Cloud Hub User

Create a Cloub Hub User to connect to USPS from Qlik Sense Cloud.

  1. Click Users -> Add
  2. Configure a User
  3. Click Save Changes and make note of the Authtoken for the new user

Connect to USPS from Cloud Hub

CData Cloud Hub uses a straightforward, point-and-click interface to connect to data sources and generate APIs.

  1. Open Cloud Hub and click Databases
  2. Select "USPS" from Available Data Sources
  3. Enter the necessary authentication properties to connect to USPS.

    To authenticate with USPS, set the following connection properties.

    • PostageProvider: The postage provider to use to process requests. Available options are ENDICIA and STAMPS. If unspecified, this property will default to ENDICIA.
    • UseSandbox: This controls whether live or test requests are sent to the production or sandbox servers. If set to true, the Password, AccountNumber, and StampsUserId properties are ignored.
    • StampsUserId: This value is used for logging into authentication to the Stamps servers. This value is not applicable for Endicia and is optional if UseSandbox is true.
    • Password: This value is used for logging into Endicia and Stamps servers. If the postage provider is Endicia, this will be the pass phrase associated with your postage account. It is optional if UseSandbox is true.
    • AccountNumber: The shipper's account number. It is optional if UseSandbox is true.
    • PrintLabelLocation: This property is required to use the GenerateLabels or GenerateReturnLabels stored procedures. This should be set to the folder location where generated labels should be stored.

    The Cache Database

    Many of the useful task available from USPS require a lot of data. To ensure this data is easy to input and recall later, utilize a cache database to make requests. Set the cache connection properties in order to use the cache:

    • CacheLocation: The path to the cache location, for which a connection will be configured with the default cache provider. For example, C:\users\username\documents\uspscache

    As an alternative to CacheLocation, set the combination of CacheConnection and CacheProvider to configure a cache connection using a provider separate from the default.

  4. Click Test Database
  5. Click Privileges -> Add, and add the new user (or an existing user) with the appropriate permissions (SELECT is all that is required for Reveal)

Add USPS OData Endpoints in Cloud Hub

After connecting to USPS, create OData Endpoint for the desired table(s).

  1. Click OData -> Tables -> Add Tables
  2. Select the USPS database
  3. Select the table(s) you wish to work with and click Next
  4. (Optional) Edit the resource to select specific fields and more
  5. Save the settings

(Optional) Configure Cross-Origin Resource Sharing (CORS)

When accessing and connecting to multiple domains from an application such as Ajax, there is a possibility of violating the limitations of cross-site scripting. In that case, configure the CORS settings in OData -> Settings.

  • Enable cross-origin resource sharing (CORS): ON
  • Allow all domains without '*': ON
  • Access-Control-Allow-Methods: GET, PUT, POST, OPTIONS
  • Access-Control-Allow-Headers: Authorization

Save the changes to the settings.

Create a Qlik Sense App from USPS Data

With the connection to USPS and OData endpoints created, we are ready to add USPS data to a Qlik Sense app for visualizations, analytics, reporting, and more.

Create a New App and Upload Data

  1. Log into your Qlik Sense instance and click the button to create a new app
  2. Name and configure the new app and click "Create"
  3. In the workspace, click to open the new app
  4. Click to add data from files and other sources
  5. Select the REST connector and set the configuration properties. For the most part, you will use the default values, with the following exceptions:
    • URL: Set this to the API endpoint for your USPS table, using the @CSV URL parameter to ensure a CSV response (i.e. https://www.cdatacloud.net/api.rsc/MYINSTANCE/USPS_Senders?@CSV)
    • Authentication Schema: Set this to "Basic"
    • User Name: Set this to the user name you configured above
    • Password: Set this to the Authtoken for the above user
  6. Click "Create" to query the Cloud Hub for the USPS data
  7. Check "CSV has header" and under "Tables," select "CSV_source"
  8. Select columns and click "Add data"

Generate Insights or Customize Your App

With the data loaded into Qlik Sense, you are ready to begin discovering insights. Click "Generate insights" to let Qlik analyze your data. Otherwise, you can build custom visualizations, reports, and dashboards based on your USPS data.

More Information & Free Trial

Now, you have created a simple but powerful dashboard from live USPS data. For more information on creating OData feeds from USPS (and more than 200 other data sources), visit the Cloud Hub page. Sign up for a free trial and start working with live USPS data in Qlik Sense Cloud.