Weather Service API
Get Weather by Country and City
Request URL
POST /api/v1.0/invoke/open-ability/method/general-commands
Request Parameter
| Parameter Name | Type | Location | Required | Description |
|---|---|---|---|---|
| Content-Type | String | Header | Yes | Content type, the value is application/json |
| Accept | String | Header | Yes | Accept, the value is application/json |
| Authorization | String | Header | Yes | Bearer authorization, access token |
| command | String | Body | Yes | Command name |
| id | String | Body | Yes | Command ID |
| param | Object<param> | Body | Yes | Command parameter |
param description
| Parameter Name | Type | Location | Required | Description |
|---|---|---|---|---|
| country | String | Body | Yes | Country |
| state_province | String | Body | Yes | State or province |
| city | String | Body | Yes | City |
Return Parameter
| Parameter Name | Type | Location | Description |
|---|---|---|---|
| Content-Type | String | Header | Content type, the value is application/json |
| success | Boolean | Body | Whether the request is successful or not? true: success false: failure |
| timestamp | Integer | Body | Timestamp |
| result | Object<result> | Body | Return result |
result description
| Parameter Name | Type | Location | Description |
|---|---|---|---|
| weather | String | Body | Weather type sunny cloudy rainy snowy foggy |
| temperature | String | Body | Temperature (℃) |
| humidity | String | Body | Humidity (%RH) |
| wind_speed | String | Body | Wind speed (m/s) |
| aqi | String | Body | Air quality index |
Request Example
POST /api/v1.0/invoke/open-ability/method/general-commands
Content-Type: application/json
Accept: application/json
Authorization: Bearer ac45e846ca23ab42c9ae469d988ae32a9
{
"command": "get_weather_by_country_and_city",
"id": "c45e846ca23ab42c9ae469d988ae32a96",
"param": {
"country": "Brazil",
"state_province": "Bahia",
"city": "Rodelas"
}
}
Success Return Example
Status Code: 200
{
"success": true,
"timestamp": 1540869200562,
"result": {
"aqi": "19",
"humidity": "79",
"temperature": "21",
"weather": "sunny",
"wind_speed": "4.725265"
}
}
Failure Return Example
Get Weather by Longitude and Latitude
Request URL
POST /api/v1.0/invoke/open-ability/method/general-commands
Request Parameter
| Parameter Name | Type | Location | Required | Description |
|---|---|---|---|---|
| Content-Type | String | Header | Yes | Content type, the value is application/json |
| Accept | String | Header | Yes | Accept, the value is application/json |
| Authorization | String | Header | Yes | Bearer authorization, access token |
| command | String | Body | Yes | Command name |
| id | String | Body | Yes | Command ID |
| param | Object<param> | Body | Yes | Command parameter |
param description
| Parameter Name | Type | Location | Required | Description |
|---|---|---|---|---|
| latitude | String | Body | Yes | Latitude |
| longitude | String | Body | Yes | Longitude |
Return Parameter
| Parameter Name | Type | Location | Description |
|---|---|---|---|
| Content-Type | String | Header | Content type, the value is application/json |
| success | Boolean | Body | Whether the request is successful or not? true: success false: failure |
| timestamp | Integer | Body | Timestamp |
| result | Object<result> | Body | Return result |
result description
| Parameter Name | Type | Type | Location | Location | Description |
|---|---|---|---|---|---|
| weather | String | String | Body | Body | Weather type sunny cloudy rainy snowy foggy |
| temperature | String | String | Body | Body | Temperature (℃) |
| humidity | String | String | Body | Body | Humidity (%RH) |
| wind_speed | String | Body | Body | Wind speed (m/s) | Wind speed (m/s) |
| aqi | String | Body | Body | Air quality index | Air quality index |
Request Example
POST /api/v1.0/invoke/open-ability/method/general-commands
Content-Type: application/json
Accept: application/json
Authorization: Bearer ac45e846ca23ab42c9ae469d988ae32a9
{
"command": "get_weather_by_longitude_and_latitude",
"id": "c45e846ca23ab42c9ae469d988ae32a96",
"param": {
"latitude": "-8.8508",
"longitude": "-38.7558"
}
}
Success Return Example
Status Code: 200
Content-Type: application/json
{
"success": true,
"timestamp": 1540869200562,
"result": {
"aqi": "19",
"humidity": "79",
"temperature": "21",
"weather": "sunny",
"wind_speed": "4.725265"
}
}