API

LocationBox API

Weather Report

Weather Report Service gives weather forecast in 5 days for citys based on criterias which you can find below.

A Weather Forecast request must look like this:

http://www.locationbox.com.tr/locationbox/services?Key=key&Cmd=WeatherReport&Typ=output_format
&IlId=ilid


Request Parameters


Key: LocationBox user key. (Register for user key)
Cmd: LocationBox service name. (WeatherForecast)
Typ: Response format. (XML or JSON)
IlId:Id of City (See list.)

Response Parameters


XML Response

Weather Forecast response returns in XML format when the Typ parameter is set as "XML".

Below is an example for a Weather Forecast request which is expected to return a response in XML format .

http://www.locationbox.com.tr/locationbox/services?Key=key&Cmd=WeatherReport&Typ=XML&IlId=1

The response will be as following:

<response>
 <transactionid>LBS_37525910</transactionid>
 <status>0</status>
 <errno />
 <errdesc />
 <items>
  <weatherreport>
   <ilid>1</ilid>
   <iladi>Adana</iladi>
   <weatherdate>04-04-2014</weatherdate>
   <condition>KISMEN GÜNEÞLÝ</condition>
   <conditionforecast>AZ BULUTLU</conditionforecast>
   <temp>21.0</temp>
   <humidity>59.0</humidity>
   <pressure>0.0</pressure>
   <windspeed>22.0</windspeed>
   <windfrom>GÜNEY</windfrom>
   <visibility>16.0</visibility>
  <forescasts>
  <day1>
   <condition>ÇOÐUNLUKLA BULUTLU/YAÐMURLU</condition>
   <lowtemp>13.0</lowtemp>
   <hightemp>23.0</hightemp>
   </day1>
  <day2>
   <condition>KISMEN GÜNEÞLÝ</condition>
   <lowtemp>16.0</lowtemp>
   <hightemp>28.0</hightemp>
  </day2>

   ...

  </forescasts>
  </weatherreport>
  </response>

JSON Response

Weather Forecast response returns in JSON format when the Typ parameter is set as "JSON".

Below is an example for a Weather Forecast request which is expected to return a response in JSON format .

http://www.locationbox.com.tr/locationbox/services?Key=key&Cmd=WeatherReport&Typ=JSON&IlId=1

The response will be as following:


{ "transactionid": "LBS_41194", "status": 0, "weatherreport": { "ilid": 1, "iladi": "Adana", "weatherdate": "04-04-2014", "condition": "KISMEN GÜNEÞLÝ", "conditionforecast": "AZ BULUTLU", "temp": 21.0, "humidity": 59.0, "pressure": 0.0, "windspeed": 22.0, "windfrom": "GÜNEY", "forecasts": { "day1": { "condition": "ÇOÐUNLUKLA BULUTLU/YAÐMURLU", "lowtemp": 13.0, "hightemp": 23.0 }, "day2": { "condition": "KISMEN GÜNEÞLÝ", "lowtemp": 16.0, "hightemp": 28.0 }, "day3": { "condition": "AÇIK/AZ BULUTLU", "lowtemp": 11.0, "hightemp": 28.0 }, "day4": { "condition": "YAÐIÞLI", "lowtemp": 12.0, "hightemp": 23.0 } } } }

transactionid: The id of response given by LocationBox Service. Every response can be tracked using transactionid when necessary.
status: Response format. (XML or JSON)
result:

Status Codes
0 -- Success
1 -- Fail

errno: Error code
errdesc: Error definition

Error Codes
10001 Error processing your request. Please try again soon.
Cmd parameter is misspelled/not found.
10011 Error processing your request. Please check the Cmd parameter.
Cmd is not specified.
10012 Error processing your request. Please check the Key parameter.
Key is not specified.
10013 Error processing your request. Please check the Key parameter.
Key is invalid.
20012 No data found.