Weather API¶
Mappls SDK enables the developer to access current weather conditions around India with below list paramenters:
- Air quality index
- Temperature
- Humidity
- Wind
- Visibility
Implementation¶
Java¶
MapplsWeather weather = MapplsWeather.builder()
.location(28.0, 77.0)
.build();
//To call in Foreground thread
MapplsWeatherManager.newInstance(weather).call(new OnResponseCallback<WeatherResponse>() {
@Override
public void onSuccess(WeatherResponse response) {
//Handle Response
}
@Override
public void onError(int code, String message) {
//Handle Error
}
});
//OR
//To call in background Thread
ApiResponse<WeatherResponse> response =MapplsWeatherManager.newInstance(weather).executeCall();
Kotlin¶
val weather = MapplsWeather.builder()
.location(28.0, 77.0)
.build()
//To call in Foreground thread
MapplsWeatherManager.newInstance(weather).call(object : OnResponseCallback<WeatherResponse> {
override fun onSuccess(response: WeatherResponse) {
//Success
}
override fun onError(code: Int, message: String) {
//Handle Error
}
})
//OR
//To call in background Thread
val response =MapplsWeatherManager.newInstance(weather).executeCall()
Request Parameters¶
Mandatory Parameter¶
location (Double, Double): Location of the place.
Optional Parameter¶
tempUnit (String): Unit of temperature. Below are the available value:- WeatherCriteria.UNIT_CELSIUS: for centigrate(°C)
- WeatherCriteria.UNIT_FARENHEIT: for farenheit (F)
theme (String): This parameter is used to define the theme of icon. Below are the available value:- WeatherCriteria.THEME_LIGHT (Default)
- WeatherCriteria.THEME_DARK
size (String ): This parameter is used to define the size of icon. Below are the available value:- WeatherCriteria.SIZE_36PX (Default)
- WeatherCriteria.SIZE_24PX
unitType (String): This parameter defines the unit type on the basis of which weather forecast information is sought for. Below are the available value:- WeatherCriteria.UNIT_TYPE_DAY
- WeatherCriteria.UNIT_TYPE_HOUR
unit (Integer): This parameter is the value for which forecast information is sought for. Valid values are:- For Days
1510
- For Hours
124
- For Days
Response Code (as HTTP response code)¶
Success:¶
- 200: To denote a successful API call.
- 204: To denote the API was a success but no results we’re found.
Client side issues:¶
- 400: Bad Request, User made an error while creating a valid request.
- 401: Unauthorized, Developer’s key is not allowed to send a request with restricted parameters.
- 403: Forbidden, Developer’s key has hit its daily/hourly limit.
Server-Side Issues:¶
- 500: Internal Server Error, the request caused an error in our systems.
- 503: Service Unavailable, during our maintenance break or server downtimes.
Response Messages (as HTTP response message)¶
- 200: Success.
- 204: No matches we’re found for the provided query.
- 400: Something’s just not right with the request.
- 401: Access Denied.
- 403: Services for this key has been suspended due to daily/hourly transactions limit.
- 500: Something went wrong.
- 503: Maintenance Break.
Response parameters¶
data(WeatherData)
WeatherData result parameters:¶
-
temperature(WeatherTemperature) #### WeatherTemperature result parameters:value(Double): Temperature value.For eg:31.3unit(String): Temperature unit.For eg:"°C"
-
weatherCondition(WeatherCondition): Weather condition infoWeatherCondition result parameters:¶
weatherId(Integer): Id of Weather condition. For eg:5weatherText(String): Weather condition info text.For eg:"Hazy sunshine"weatherDescription(String): Description of weather For eg: "Total cloud cover between 20%-60%"weatherIcon(String): Weather condition icon url.realFeelWeatherText(String):Description of weather For eg:"Feels Like 41.0 °C"
-
airQuality(AirQuality): Air Quality info #### AirQuality result parameters:airQualityIndex(Integer): Give the value of air quality index. For eg:104airQualityIndexText(String): Description for AQI given. For eg: "Unhealthy for Sensitive Groups"airQualityIndexUnit(String): Gives the values of airquality index unit. For eg: "PM2.5"
-
humidity(Humidity): Humidity infoHumidity result parameters:¶
relHumidity(Integer): Provides the value for humidity. For Eg: 65indoorRelHumidity(Integer): Provide value for indoor relative humidity . For eg: 65
-
wind(Wind): Wind InfoWind result parameters:¶
windSpeed(Double):For Eg:12.8windSpeedUnit(String):For Eg: "KM/H"windAngle(Integer):For Eg: 338windAngleUnit(String): For Eg: "NNW"
-
visibility(WeatherVisibility): Visibility Info #### WeatherVisibility result parameters:value(Integer): Visibilty value. For eg: 2unit(String): Unit of Visibilty value. For eg: "KM"
-
forecastData(List<ForecastData>): This feature is available for your solutions to get forecast details. The API is able to populate current weather condition andforecastof1,5&10days (depending on input)or hours based forecast for1hr and24hrs.ForecastData result parameters:¶
hour(String): Value Returned when request is made for hours. For eg: "26/09/2022 18:00",date(String): Value Returned when request is made for multiple day/days. For eg: "28/09/2022",day(String): Represents day name when request is made for multiple day/days. For eg: "Wednesday".-
temperature(WeatherTemperature):minTemperature(Double): Minimum temperature value for the day/night.For eg:31.3minTemperatureUnit(String): Minimum Temperature Unit. For eg:"°C"maxTemperature(Double): Maximum Temperature value for the day/night.For eg:31.3maxTemperatureUnit(String): Maximum Temperature Unit. For eg:"°C"
-
weatherCondition(WeatherCondition)weatherIdDay(Integer): Shows the ID of the day For Eg: 1weatherTextDay(String): Shows the forcast description for the day For Eg: "Sunny"weatherIconDay(String): Shows the forcast icon for day For Eg: "1.png"weatherIdNight(Integer): Shows the ID of the night For Eg: 33weatherTextNight(String): Shows the forcast description for the night For Eg: "Clear"weatherIconNight(String): Shows the forcast icon for the night For Eg: "33.png"
For any queries and support, please contact:
Email us at apisupport@mappls.com
Support
Need support? contact us!
