API, or Application Program Interface, is a protocol used by applications to retrieve information. The Information comes from web pages, where it is stored. The APIs you are going to use get questions/conditions from the their URL. By giving the API different URLs, the application can ask after for the specific information it needs and this way it will not receive more than it can handle.
Temperature API
This particular API’s parameters requires a city and country and will return the temperature of that city.
Copy this text to a web browser: “http://verkstad.cc/iot/mmx/code/get_temperature.php?city=london&country=gb”
This will get the temperature in London, Great Britain. Try changing the parameters so that the Arduino Temperature API will return the temperature in Tokyo, Japan.
Try some other countries to see the temperature differences, perhaps between day and night or winter and summer. To get started, here is a list of some country codes.
Country list:
- Australia = AU
- China = CN
- Egypt = EU
- India = IN
- Japan = JP
- Russia = RU
- South Africa = ZA
- Spain = ES
- Sweden = SV
- United Kingdom = GB
- United States of America = US
For a full list, click here: https://en.wikipedia.org/wiki/ISO_3166-1#Current_codes