Orektic Solutions

Connect noKodr with external sources using Rest API

What is WeatherAPI? 


WeatherAPI is an online service owned by WeatherAPI that provides global weather data via API, including current weather data, forecasts, and historical weather data for any geographical location. The company offers a minute-by-minute hyperlocal precipitation forecast for any location.  

One Call allows users to receive access to the various data for a specific location and includes: 

  • Current weather 

  • Minute forecast for 1 hour 

  • Hourly forecast for 48 hours 

  • Daily forecast for 8 days 

  • Government weather alerts 

Weather API provides an API with JSON, XML, and HTML endpoints and a limited free usage tier.  

To use this current weather data API, one must need the API key which can be obtained once the user creates an account on https://www.weatherapi.com  

Read Weather API Documentation to understanding about different parameters and capabilities. 

Setup WeatherAPI on http://weatherapi.com  

Picture3-20240215-063627.png
Figure 1: Setup WeatherAPI

Step 1: Getting the Weather API Key 

To get the API key, we need to register with WeatherAPI. After signing up, it will redirect us to the profile settings. 

  • Click here to open the Weather website. 

  • Click the Sign in button. 

  • A new window opens. If you already have an account on the website, enter your credentials. Otherwise, click the Create an Account option. 

  • Once your account is ready, you are automatically directed to the Weather page where you signed in. It asks you about your company, and the purpose of using the Weather platform. 

  • From the top menu bar, click on your username next to the For Business label and select My API keys from the dropdown list. This will redirect you to a page where you’ll see an API key named Default. 

 

Setup Named Credentials on Salesforce 

Picture2-20240215-063457.png
Figure 2: Setup Named Credentials on Salesforce

Step 2: Create an External Credential 

  • Click Setup

  • In the Quick Find box, enter Named Credentials, and then select External Credentials

  • Click New

  • Fill out the page with the Authentication Protocol as Custom. 

  • Click Save

Step 3: Define Principals and Custom Headers 

  • Click New on Principals section of External Credentials

  • Fill out the Authentication Parameter with the API Key generated. 

  • Click Save

  • Click New on Custom Headers of External Credentials

  • Fill out the Authentication Parameter with the API Key generated. 

  • Click Save

  • Provide access to Profile by selecting the created External Credential and add under Enable External Credential Principal Access section of User. 

 

 Step 4: Setup Named Credentials 

  • Click New on Named Credentials. 

  • Fill out the form and give URL as endpoint link of API. 

  • Select the External Credentials

  • Under Managed Package Access, give the name space of the Managed Package, here it is “pwr” 

  • Click Save

Start Building On noKodr app 

Step 5: Create Model In noKodr and start building 

  • Select Models and Click New. 

  • Fill out the Details tabs with Connection with the Named Credential just created. 

  • Select the Request tab and choose the Method URL and parameters used to make the callout. See Weather API Documentation for more information. 

  • Select Response tab and click on Generate Schema. Paste a sample response body and click Merge

  • Click Save

 

You can now go ahead with creating your application with your data connected.

 

AppExchange Link: https://appexchange.salesforce.com/appxListingDetail?listingId=a0N4V00000GZCsrUAH

 

Orektic Solutions