How to use IBM® App Connect with The Weather Company

The Weather Company enables users to gain accurate insights and make informed decisions based on upcoming weather forecasts.

Availability:
  • A connector in IBM App Connect Enterprise as a ServiceApp Connect Enterprise as a Service connector
  • A local connector in a Designer instance of IBM App Connect in containers (Continuous Delivery release)Local connector in containers (Continuous Delivery release)
  • A local connector in a Designer instance of IBM App Connect in containers (Support Cycle 2)Local connector in containers (Long Term Support Cycle-2 release)

Supported product and API versions

To find out which product and API versions this connector supports, see Detailed System Requirements on the IBM Support page.

Connecting to The Weather Company

Complete the connection fields that you see in the App Connect Designer Connect > Applications and APIs page or flow editor. If necessary, work with your The Weather Company administrator to obtain these values.

The Weather Company connection fields:

BASIC
Account name: Provide a meaningful name to your account that helps you to identify it.
API key: A unique key that provides access to The Weather Company APIs. Some actions (for example, Get forecast and Retrieve historical observations) do not support Basic authentication. For those actions, use BASIC JWT authentication. Basic JWT authentication requires a separate API key, a client ID, and an Organization ID from The Weather Company.
BASIC JWT
Account name: Provide a meaningful name to your account that helps you to identify it.
API key: A unique key that provides access to The Weather Company APIs. Some actions (for example, Get forecast and Retrieve historical observations) do not support Basic authentication. For those actions, use BASIC JWT authentication. Basic JWT authentication requires a separate API key, a client ID, and an Organization ID from The Weather Company.
Organization ID: The identifier for your organization provided by The Weather Company for BASIC JWT authentication.
Client ID: The client ID provided by The Weather Company for BASIC JWT authentication.

To obtain the connection values for The Weather Company, see Obtaining connection values for The Weather Company

To connect to a The Weather Company endpoint from the App Connect Designer Applications and APIs page for the first time, expand The Weather Company, then click Connect.

Tip:

Before you use the account that is created in App Connect in a flow, rename the account to something meaningful that helps you to identify it. To rename the account on the Applications and APIs page, select the account, open its options menu (⋮), then click Rename Account.

General considerations

Before you use App Connect Designer with The Weather Company, take note of the following considerations:

  • To specify a location it is best to use geocode values; as latitude,longitude coordinates. (Weather data generally are stored and accessed in grids, and sending a postcode means the system has to look up the nearest grid point, which can introduce errors.)
  • If you want to find the value for a location Place ID, you can use a location action in a flow or use the The Weather Company API. For example, you can use the Get location by point action with a geocode value or use the following API call:
    https://api.weather.com/v3/location/point?geocode=lat,long&language=en-US&format=json&apiKey=yourApiKey
  • The Get forecast action returns the weather foreacast for the next 14 days (as Agg1 through Agg14) starting from tomorrow. The following example shows the kind of response that is returned for this action.
    {
      "point": {
     "id": null,
     "lat": 51.03,
     "lon": -1.4
      },
      "aggs": [
     {
    "Date": "2022-03-02",
    "Gust": {
      "LOCAL_DAY": {
     "min": 7,
     "max": 7,
     "avg": 7
      },
      "LOCAL_DAYTIME": {
     "min": 7,
     "max": 7,
     "avg": 7
      },
      "LOCAL_NIGHTTIME": {
     "min": null,
     "max": null,
     "avg": null
      },
      "LOCAL_MORNING": {
     "min": null,
     "max": null,
     "avg": null
      },
      "LOCAL_AFTERNOON": {
     "min": 7,
     "max": 7,
     "avg": 7
      },
      "LOCAL_EVENING": {
     "min": null,
     "max": null,
     "avg": null
      },
      "LOCAL_OVERNIGHT": {
     "min": null,
     "max": null,
     "avg": null
      }
    },
    "PrecipAmount": {
      "LOCAL_DAY": {
     "min": 0,
     "max": 0.66,
     "avg": 0.2520833333333333
      },
      "LOCAL_DAYTIME": {
     "min": 0,
     "max": 0.45,
     "avg": 0.18916666666666668
      },
      "LOCAL_NIGHTTIME": {
     "min": 0,
     "max": 0.1,
     "avg": 0.02666666666666667
      },
      "LOCAL_MORNING": {
     "min": 0.2,
     "max": 0.45,
     "avg": 0.30833333333333335
      },
      "LOCAL_AFTERNOON": {
     "min": 0,
     "max": 0.12,
     "avg": 0.07
      },
      "LOCAL_EVENING": {
     "min": 0,
     "max": 0,
     "avg": 0
      },
      "LOCAL_OVERNIGHT": {
     "min": 0,
     "max": 0.1,
     "avg": 0.05333333333333334
      }
    },
    "RelativeHumidity": {
      "LOCAL_DAY": {
     "min": 88,
     "max": 98,
     "avg": 93.875
      },
      "LOCAL_DAYTIME": {
     "min": 88,
     "max": 98,
     "avg": 93
      },
      "LOCAL_NIGHTTIME": {
     "min": 90,
     "max": 97,
     "avg": 93.5
      },
      "LOCAL_MORNING": {
     "min": 92,
     "max": 98,
     "avg": 96.16666666666667
      },
      "LOCAL_AFTERNOON": {
     "min": 88,
     "max": 92,
     "avg": 89.83333333333333
      },
      "LOCAL_EVENING": {
     "min": 90,
     "max": 95,
     "avg": 91.33333333333333
      },
      "LOCAL_OVERNIGHT": {
     "min": 94,
     "max": 97,
     "avg": 95.66666666666667
      }
    },
    "Temperature": {
      "LOCAL_DAY": {
     "min": 279,
     "max": 282,
     "avg": 280.2916666666667
      },
      "LOCAL_DAYTIME": {
     "min": 280,
     "max": 282,
     "avg": 280.75
      },
      "LOCAL_NIGHTTIME": {
     "min": 279,
     "max": 281,
     "avg": 280
      },
      "LOCAL_MORNING": {
     "min": 280,
     "max": 281,
     "avg": 280.5
      },
      "LOCAL_AFTERNOON": {
     "min": 280,
     "max": 282,
     "avg": 281
      },
      "LOCAL_EVENING": {
     "min": 279,
     "max": 280,
     "avg": 279.6666666666667
      },
      "LOCAL_OVERNIGHT": {
     "min": 280,
     "max": 281,
     "avg": 280.3333333333333
      }
    },
    "WindSpeed": {
      "LOCAL_DAY": {
     "min": 3,
     "max": 4,
     "avg": 3.75
      },
      "LOCAL_DAYTIME": {
     "min": 3,
     "max": 4,
     "avg": 3.9166666666666665
      },
      "LOCAL_NIGHTTIME": {
     "min": 3,
     "max": 3,
     "avg": 3
      },
      "LOCAL_MORNING": {
     "min": 4,
     "max": 4,
     "avg": 4
      },
      "LOCAL_AFTERNOON": {
     "min": 3,
     "max": 4,
     "avg": 3.8333333333333335
      },
      "LOCAL_EVENING": {
     "min": 3,
     "max": 3,
     "avg": 3
      },
      "LOCAL_OVERNIGHT": {
     "min": 3,
     "max": 3,
     "avg": 3
      }
    }
     },
    ...
     {
    "Date": "2022-03-15",
    "Gust": {
      "LOCAL_DAY": {
     "min": 7,
     "max": 10,
     "avg": 8.764705882352942
      },
      "LOCAL_DAYTIME": {
     "min": 7,
     "max": 10,
     "avg": 9
      },
      "LOCAL_NIGHTTIME": {
     "min": 8,
     "max": 9,
     "avg": 8.5
      },
      "LOCAL_MORNING": {
     "min": 7,
     "max": 10,
     "avg": 8.666666666666666
      },
      "LOCAL_AFTERNOON": {
     "min": 8,
     "max": 10,
     "avg": 9.333333333333334
      },
      "LOCAL_EVENING": {
     "min": 8,
     "max": 9,
     "avg": 8.333333333333334
      },
      "LOCAL_OVERNIGHT": {
     "min": 8,
     "max": 9,
     "avg": 8.75
      }
    },
    "PrecipAmount": {
      "LOCAL_DAY": {
     "min": 0,
     "max": 0.28,
     "avg": 0.14916666666666667
      },
      "LOCAL_DAYTIME": {
     "min": 0,
     "max": 0.2,
     "avg": 0.16666666666666666
      },
      "LOCAL_NIGHTTIME": {
     "min": 0,
     "max": 0.28,
     "avg": 0.14833333333333334
      },
      "LOCAL_MORNING": {
     "min": 0.2,
     "max": 0.2,
     "avg": 0.20000000000000004
      },
      "LOCAL_AFTERNOON": {
     "min": 0,
     "max": 0.2,
     "avg": 0.13333333333333333
      },
      "LOCAL_EVENING": {
     "min": 0,
     "max": 0.28,
     "avg": 0.1466666666666667
      },
      "LOCAL_OVERNIGHT": {
     "min": 0.1,
     "max": 0.2,
     "avg": 0.15
      }
    },
    "RelativeHumidity": {
      "LOCAL_DAY": {
     "min": 74,
     "max": 88,
     "avg": 82.58333333333333
      },
      "LOCAL_DAYTIME": {
     "min": 74,
     "max": 88,
     "avg": 79.25
      },
      "LOCAL_NIGHTTIME": {
     "min": 82,
     "max": 87,
     "avg": 85.41666666666667
      },
      "LOCAL_MORNING": {
     "min": 75,
     "max": 88,
     "avg": 82.33333333333333
      },
      "LOCAL_AFTERNOON": {
     "min": 74,
     "max": 80,
     "avg": 76.16666666666667
      },
      "LOCAL_EVENING": {
     "min": 82,
     "max": 87,
     "avg": 84
      },
      "LOCAL_OVERNIGHT": {
     "min": 86,
     "max": 87,
     "avg": 86.83333333333333
      }
    },
    "Temperature": {
      "LOCAL_DAY": {
     "min": 280,
     "max": 284,
     "avg": 281.7083333333333
      },
      "LOCAL_DAYTIME": {
     "min": 280,
     "max": 284,
     "avg": 282.6666666666667
      },
      "LOCAL_NIGHTTIME": {
     "min": 280,
     "max": 282,
     "avg": 281.0833333333333
      },
      "LOCAL_MORNING": {
     "min": 280,
     "max": 284,
     "avg": 281.6666666666667
      },
      "LOCAL_AFTERNOON": {
     "min": 283,
     "max": 284,
     "avg": 283.6666666666667
      },
      "LOCAL_EVENING": {
     "min": 281,
     "max": 282,
     "avg": 281.5
      },
      "LOCAL_OVERNIGHT": {
     "min": 280,
     "max": 281,
     "avg": 280.6666666666667
      }
    },
    "WindSpeed": {
      "LOCAL_DAY": {
     "min": 5,
     "max": 8,
     "avg": 6.5
      },
      "LOCAL_DAYTIME": {
     "min": 6,
     "max": 8,
     "avg": 7
      },
      "LOCAL_NIGHTTIME": {
     "min": 6,
     "max": 7,
     "avg": 6.583333333333333
      },
      "LOCAL_MORNING": {
     "min": 6,
     "max": 8,
     "avg": 6.666666666666667
      },
      "LOCAL_AFTERNOON": {
     "min": 6,
     "max": 8,
     "avg": 7.333333333333333
      },
      "LOCAL_EVENING": {
     "min": 6,
     "max": 7,
     "avg": 6.5
      },
      "LOCAL_OVERNIGHT": {
     "min": 6,
     "max": 7,
     "avg": 6.666666666666667
      }
    }
     }
      ],
      "datesAscending": [
     "2022-03-02",
     "2022-03-03",
     "2022-03-04",
     "2022-03-05",
     "2022-03-06",
     "2022-03-07",
     "2022-03-08",
     "2022-03-09",
     "2022-03-10",
     "2022-03-11",
     "2022-03-12",
     "2022-03-13",
     "2022-03-14",
     "2022-03-15"
      ]
    }
  • A Get forecast action can sometimes return null values for some forecast variables; for example, null is reported for wind gusts when there is nothing significant over the average wind speeds. To test for null cases, you can use the JSONata isNull(variable); for example, a variable might be given the following JSONata expression:
    $isNull($TheWeatherCompanyGetforecast.aggs[0].Gust.LOCAL_MORNING.max) ? $TheWeatherCompanyGetforecast.aggs[0].WindSpeed.LOCAL_MORNING.max : $TheWeatherCompanyGetforecast.aggs[0].Gust.LOCAL_MORNING.max

    This example tests if the maximum gust for the morning (Gust.LOCAL_MORNING.max) is null. If it is null, the variable takes the value of the maximum windspeed for the morning. If it is not null, the variable takes the value of the maximum gust for the morning.

  • (General consideration) You can see lists of the trigger events and actions that are available on the Applications and APIs page of the App Connect Designer.

    For some applications, the events and actions depend on the environment and whether the connector supports configurable events and dynamic discovery of actions. If the application supports configurable events, you see a Show more configurable events link under the events list. If the application supports dynamic discovery of actions, you see a Show more link under the actions list.

  • (General consideration) If you are using multiple accounts for an application, the set of fields that is displayed when you select an action for that application can vary for different accounts. In the flow editor, some applications always provide a curated set of static fields for an action. Other applications use dynamic discovery to retrieve the set of fields that are configured on the instance that you are connected to. For example, if you have two accounts for two instances of an application, the first account might use settings that are ready for immediate use. However, the second account might be configured with extra custom fields.

Events and actions

The Weather Company events

These events are for changes in this application that trigger a flow to start completing the actions in the flow.

Note: Events are not available for changes in this application. You can trigger a flow in other ways, such as at a scheduled interval or at specific dates and times.

The Weather Company actions

Your flow completes these actions on this application.

Object Action Description
Current conditions Get current condition Get current condition
Forecasts Get forecast Get forecast
Historical observations Retrieve historical observations Retrieve historical observations
Locations Get locations Get locations
Locations by point Get location by point Get location by point
Near locations Get near locations Get near locations

Examples

Dashboard tile for a template that uses IBM Weather Company Data Limited Edition

Use templates to quickly create flows for The Weather Company

Learn how to use App Connect templates to create flows that complete actions in The Weather Company. For example, go to the Discover page and search for The Weather Company.

Model Context Protocol (MCP) support

The The Weather Company connector supports MCP, and all The Weather Company actions for the listed objects can be added to an MCP server as tools. For more information on how to configure an MCP server, see Creating and managing MCP servers.