Documentation

    Amazon Web Services

    Microsoft Azure

    RapidAPI

    APILayer

Last Update: 2024-09-10

Weather API


Table of Content


Subscribe on AWS Marketplace
Code sample
API endpoint: /current
API endpoint: /usage
Troubleshooting

Subscribe on AWS Marketplace


Navigate to our product listing on the AWS Marketplace. Select the "View purchase options" button to proceed.

On the following page, click the "Subscribe" button to initiate the subscription process.

After subscribing, you will need to set up your account on our platform. Do this by clicking the "Set up your account" link provided.

You will be directed to the registration page. Here, fill in your account details in the provided fields. Once you have entered all necessary information, click the 'Subscribe' button to proceed.

Upon successful registration, your unique API key will be displayed. It is crucial to store this key in a secure location for future use.

Code Samples


The code samples below call the '/current' endpoint to retrieve the current weather for the specified IP address. Replace <YourApiKey> with the actual API key you received during the sign-up process.

var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://weather-api.silverlining.cloud/current");
request.Headers.Add("x-api-key", "<YourApiKey>");
var content = new StringContent("{\n    \"ip_address\": \"185.17.12.138\"\n}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
API endpoint: /current


URL endpoint: https://weather-api.silverlining.cloud/current


Method: POST


"header": {
  "x-api-key": STRING,
  "Content-Type": "application/json"
}


"body": {
  "lat": STRING or NUMBER,
  "lon": STRING or NUMBER,
  "ip_address": STRING,
  "units": STRING
}



Required Parameters

You must provide either the geographical coordinates (latitude and longitude) or an IP address to obtain the current weather information.

"lat": Latitude of the location for which you want to retrieve the current weather.
"lon": Longitude of the location for which you want to retrieve the current weather.

OR

"ip_address": An IP address whose geo-location will be used to retrieve the weather information.

Optional Parameters

"units": Defines the units for temperature and wind speed. The available options are:

  • "metric": Temperature in Celsius and wind speed in meters per second.
  • "imperial": Temperature in Fahrenheit and wind speed in miles per hour.

The default value is "metric".


Response:

"body": {
  "lat": NUMBER,
  "lon": NUMBER,
  "current_timestamp": NUMBER,
  "sunrise": NUMBER,
  "sunset": NUMBER,
  "current_temp": NUMBER,
  "current_feels_like": NUMBER,
  "current_clouds": NUMBER,
  "current_wind_speed": NUMBER,
  "current_wind_deg": NUMBER,
  "current_rain": NUMBER,
  "current_snow": NUMBER,
  "current_weather_main": STRING,
  "current_weather_description": STRING,
  "weather_icon": STRING,
  "weather_emoji": STRING,
  "input_data": {
    "lat": STRING,
    "lon": STRING,
    "ip_address": STRING,
    "units": STRING
  }
}  


Response Parameters

"lat": The latitude of the geolocation used to retrieve the current weather.
"lon": The longitude of the geolocation used to retrieve the current weather.
"current_timestamp": The current timestamp.
"sunrise": Timestamp of today's sunrise.
"sunset": Timestamp of today's sunset.
"current_temp": The current temperature in Celsius (when "units" is "metric") or Fahrenheit (when "units" is "imperial").
"current_feels_like": The current 'feels like' temperature in Celsius (when "units" is "metric") or Fahrenheit (when "units" is "imperial").
"current_clouds": The cloudiness percentage.
"current_wind_speed": The wind speed. Units: Default: meter/sec, Metric: meter/sec, Imperial: miles/hour.
"current_wind_deg": The wind direction in degrees (meteorological).
"current_rain": The rain volume for the last hour, in millimeters.
"current_snow": The snow volume for the last hour, in millimeters.
"current_weather_main": The main description of the current weather in English (e.g., Rain, Snow, Clouds).
"current_weather_description": A detailed description of the current weather in English.
"weather_icon": URL to a corresponding weather icon (512x512) depending on the weather condition and time of day. Possible icons include:

  • https://cdn.silverlining.cloud/weather_icons/cloudy.png
  • https://cdn.silverlining.cloud/weather_icons/day_clear.png
  • https://cdn.silverlining.cloud/weather_icons/day_partial_cloud.png
  • https://cdn.silverlining.cloud/weather_icons/mist.png
  • https://cdn.silverlining.cloud/weather_icons/night_clear.png
  • https://cdn.silverlining.cloud/weather_icons/night_partial_cloud.png
  • https://cdn.silverlining.cloud/weather_icons/rain.png
  • https://cdn.silverlining.cloud/weather_icons/snow.png
  • https://cdn.silverlining.cloud/weather_icons/thunder.png

"weather_emoji": A fitting weather emoji depending on the weather condition and time of day. Possible emojis include: ☀️, 🌤️, ⛅, 🌥️, ☁️, ⛈️, 🌧️, 🌨️, 🌫️, 🌙, 🌑
"input_data": The parameters sent to the API.

API endpoint: Usage

URL endpoint: ToDo


Method: POST


"header": {
  "x-api-key": STRING,
  "Content-Type": "application/json"
}

Required 
You must include the API key in the x-api-key header. The body parameters can be left empty.

Response:


"body": {
  "reportUrl": STRING,
  "downloadLink": STRING,
  "description": STRING
}

"reportUrl": A URL linking to a web-based report that displays all requests made to the API. Note that this report is only accessible if the total number of requests is below 100,000.

"downloadLink": A URL to download a .CSV file containing all requests made to our API using the specified API key.

"description": You can access usage statistics either by visiting the website using the 'reportUrl' or by downloading the usage data as a .csv file using the 'downloadLink'. Please note that, depending on the number of requests you have previously sent to our API, these links may become available up to 10 minutes after the request is made.

Troubleshooting

"message": "Invalid Input: The request contains incorrectly formatted parameters"

This error message means that the body parameters you have passed are malformed. Please follow the instructions given in the endpoint descriptions. Common issues include forgetting to add a comma (',') after every parameter line or missing a parenthesis somewhere.

"message": "Endpoint request timed out"

You receive this error message when the code execution exceeds the maximum timeout (usually 29 seconds).

How can I cancel my subscription?

To cancel your subscription, follow these steps:

  1. Go to the AWS Marketplace Console at https://aws.amazon.com/marketplace/library. Ensure that you are logged into the account that is subscribed to the product you want to cancel.
  2. Find the product you want to cancel and click on 'Manage.'
  3. Click on 'Actions' and then select 'Cancel subscription.'

For more detailed instructions, visit the AWS Marketplace Buyer Guide at https://docs.aws.amazon.com/marketplace/latest/buyerguide/cancel-subscription.html.

The weather data is gathered from openweathermap.org.