AccuWeather

AccuWeather

AccuWeather

Asset Version: 1.0
  • Version 1.0
Last Published: Apr 21, 2017 By: Kony Team
16 1 0 3
Easily connect and retrieve weather data from Accuweather using your Accuweather provided API key. Get current weather for a specific location based on your current geolocation, zip code, city, state or country. Retrieve a weather forecast, show weather alerts and weather related maps and images using the Accuweather data adapter.

Requirements

  • MobileFabric
 

Features

  • Ready-to-use adapter and simple to import.
  • Easy to attain details through simple interaction directly from MobileFabric
  • Flexible to define custom parameters and obtain essential Data specific to the requirement

Prerequisites

  • Kony Account
  • Kony MobileFabric 7.3

AccuWeather Data Adapter allows you to make AccuWeather API calls directly from MobileFabric. You can import the component into MobileFabric. Upon successful import, you can use the MobileFabric console to make the API calls and view the responses by creating and executing required operations.

Here is a use case that describes the use of AccuWeather Data Adapter.

Use Case

Consider a case of a customer who wants the following services from AccuWeather:

  • Get weather forecast of a specified location hourly
  • Get weather forecast of a specified location daily.

In the above use case, you can develop the user interface and functionality of the mobile app using Kony Visualizer. To fetch the search results from AccuWeather, you can use MobileFabric with AccuWeather Data Adapter. In the MobileFabric console, you can create an integration service with the AccuWeather Data Adapter and create operations with the following AccuWeather APIs:

  1. Get weather forecast hourly with location key: Returns forecast data for the next hour or next 12 hours (depending upon the period) for a specific location.
  2. Get weather forecast daily with location key: Returns daily forecast data or next 5 days (depending upon the period) for a specific location.

After you create the necessary operations, you can integrate your mobile app with the integration service that you created with AccuWeather Data Adapter.

The following sections help you use the AccuWeather Data Adapter component:

Prerequisites

Before you start using the AccuWeather Data Adapter, ensure you have the following:

  1. An AccuWeather account
  2. An app created in your AccuWeather account
  3. apikey issued by AccuWeather when you created an app
  4. A Kony account
  5. Kony MobileFabric 7.3

Importing the AccuWeather Data Adapter

You can import AccuWeather Data Adapter into MobileFabric directly from Kony Marketplace or by importing the data adapter zip file.

To import the data adapter from Marketplace, do the following:

  1. Log on to your Kony account. The Dashboard page appears by default.
  2. In the left pane, click the API Management menu. The APIs tab opens by default.
  3. Click the Customer Data Adapters tab. The Custom Data Adapter page appears.
  4. Click Import. The Import Data Adapter dialog appears.
  5. Click IMPORT FROM KONY MARKETPLACE. The Import Data Adapter from Kony Marketplace dialog appears with a list of available data adapters.
  6. Find and select the AccuWeather data adapter, and click IMPORT. The AccuWeather data adapter is listed on the Custom Data Adapters page.

To import the data adapter zip file, do the following:

  1. Perform steps 1 through 4 in the above procedure.
  2. Drag the data adapter zip file into the Drag a Data Adapter box.

    Alternatively, click browse. The Open dialog appears.

    Navigate to the location where you downloaded the data adapter (zip file) on your computer, select the component, and click Open. The Import Data Adapter dialog shows the selected component.

    Note:

    If the selected data adapter zip file is not the one that you want to import, click Remove.

  3. Click Import. The AccuWeather data adapter is listed on the Custom Data Adapters page.

Creating an Integration Service with AccuWeather

After you import AccuWeather Data Adapter into MobileFabric, you must create an integration service with service type as AccuWeather to connect with your AccuWeather account.

To create an integration service with AccuWeather, do the following:

  1. Log on to your Kony account. The Dashboard page appears by default.
  2. In the left pane, click the API Management menu. The APIs tab opens by default.
  3. Click the Integration tab. The Integration tab opens with a list of existing integration services.
  4. Click CONFIGURE NEW. The Service Definition tab opens.
  5. In the Name box, type a unique name for your service.
  6. From the Service Type list, select AccuWeather.
    Note:

    The AccuWeather is listed only after you import the AccuWeather Data Adapter into MobileFabric.

  7. In the apiKey box, type the access key provided by the AccuWeather.
  8. Click Save.

If the details provided are valid, the MobileFabric service connects to your AccuWeather application and allows you to make the API calls.

Refer to Integration Services for more information on creating and using integration services.

Creating an Operation

To make any API call in the MobileFabric console, you must create an operation for the respective API and then execute the operation. Executing an operation involves making the API call and displaying the response. For more information, see Executing an Operation.

This section provides steps to create an operation for the getLocation Key API.

Steps to create an operation for the getLocation Key API

  1. Log on to your Kony account. The Dashboard page appears by default.
  2. In the left pane, click the API Management menu. The APIs tab opens by default.
  3. Click the Integration tab. The Integration page appears with a list of existing integration services.
  4. From the list of integration services, select the integration service that you have created with service type as AccuWeather. The Service Definition tab of the selected integration service opens by default.
  5. Click the Operations List tab. The Operations List tab opens.
  6. Click the context menu arrow to expand the Please Select list. The AccuWeather is displayed.
  7. Click the plus icon to expand the AccuWeather list.
  8. Click the plus icon to expand the Services list, and select getLocation Key Searching.
  9. Click ADD OPERATION. The getLoaction Key Searching operation is listed in the Configured Operations section.
Note:

You can follow the same steps to create operations for other methods, but ensure that you select the required API.

You can create multiple operations with required APIs and save them in the Configured Operations section. You can then execute the operations when ever required.

Executing an Operation

Executing an operation involves making the API call by setting the necessary parameters and displaying the response. The procedure to execute any operation is same, but the request parameters of the APIs vary. For more information on request parameters of each API, refer AccuWeather API Catalog.

This section provides steps to execute the getLocation Key Searching operation (explained in Creating an Operation).

Steps to execute the getLocation Key Searching operation:

  1. Log on to your Kony account. The Dashboard page appears by default.
  2. In the left pane, click the API Management menu. The APIs tab opens by default.
  3. Click the Integration tab. The Integration tab opens with a list of existing integration services.
  4. From the list of integration services, select the integration service that you have created with service type as AccuWeather. The Service Definition tab of the selected integration service opens by default.
  5. Click the Operations List tab.
  6. Under the Configured Operations section, click the getLocation Key operation. The getLocation Key tab opens with the Request Input sub-tab opened by default.
  7. In the Name box, the name of the operation is displayed by default. If you want, you can change the name.
  8. On the Request Input tab, in the Body section, for the following parameters, specify the values in the respective boxes under the Test Value column.
    • language: specify the language to return the resource.
    • details: Boolean value. Specify the value as true to include all details available in the specified location name in the response. Specify the value as false to retrieve no data.
    • apiDomain: Specify the value as dataservice.
    • locationKey: Provide latitude and longitude seperated by a coma.
    • mediaTypeExtension: Provide the value as .json.
    • version: Provide the value as v1.
  9. Click Test and SAVE AND FETCH RESPONSE. The Output Result dialog appears with the response.