Analyzing The National Weather Service Connection

To build a useful Connector using the Integration Framework you must know the following: 

  • The API or datastore to access
  • Data that you want to get and set
  • How the API works

Typically, we use a program like Postman to interactively see how the API responds. For a very simple API you might just need the URL, but for more complicated APIs you need the API documentation.

In this sample project, we are going to walk through the process of creating a connection to the National Weather Service. To access the National Weather Service we have the following URI:

http://graphical.weather.gov/xml/sample_products/browser_interface/ndfdBrowserClientByDay.php?zipCodeList=03104&format=24+hourly&numDays=7

Since this is just a URL, we started with the easiest thing and put it into a browser. This returns some data as XML, which tells us a few things about how this API works.

The HTTPMethod we are using is a GET. Unless otherwise specified, a browser uses a GET. We can also break the URL into two distinct parts: the part before the question mark and the part after.

http://graphical.weather.gov/xml/sample_products/browser_interface/ndfdBrowserClientByDay.php

The part above is before the ? and includes the protocol, the domain name, the path and the file name. Many of these pieces are optional.

zipCodeList=03104&format=24+hourly&numDays=7

This is the part after the ? and includes the Query Parameters. The syntax for each query parameter is a key and a value separated by = and each query parameter is separated by &.

The partial URL above has 3 query parameters:

Key

Value

zipCodeList
03104
format
24+hourly
numDays
7

Understanding the various parts of an HTTP Request is important when building the Connector, because you must map values from TIBCO Scribe® to those HTTP Request.

By reviewing this call, we know that we are trying to get weather information, not set it, and we know that the URI is:

http://graphical.weather.gov/xml/sample_products/browser_interface/ndfdBrowserClientByDay.php

We also know that the call has three query parameters with hard-coded keys and values. To make this service more useful, we need to allow the end user to specify the ZipCode. Since the parameter is named zipCodeList, it is likely that we could provide a comma delimited list of zip codes to receive multiples. However, for this sample, we will use only one zip code.

Typically, the payload of these more complex objects is either JSON or XML. It is important to know which one because the Integration Framework has built in functionality to facilitate working with these types of data. Based on the Response displayed in the browser, we know we are working in XML. We want to leverage the power of already established tools to turn that XML into .NET types, which provide:

  • Built in serializer.
  • Built in Reflection over those data types to translate them into metadata and Data Entities that TIBCO Scribe® understands.

See Also

Building A TIBCO Scribe® Connector For National Weather Service

Starting The National Weather Service Project

Generating The National Weather Service Connector Code

Reviewing Sample National Weather Service Connector Generated Code