What is an API? API stands for Application Programming Interface. An Application is software that has a specific function and this could be hosted anywhere. An Interface is designed to allow applications to exchange information through requests and responses.
Many software-as-a-service (SaaS) providers offer APIs that let developers write code that posts data to and retrieves data from the server. Examples are: Paypal, Stripe, Google Maps, most Weather companies, News, and many more. If you have an API we can work with that to retrieve information and carry out tasks through your web site.
Databases are used to store data for dynamic page generation or API. Site Admin edits page information through forms allowing local edits of page information or adding new pages or products, bookings, posts, galleries etc. APIs require information before they will return data or take action. This data can be stored in a database as can any data returned. Database driven sites are common - WordPress is database driven along with any Content Management System.
The following example uses 2 APIs to retrieve your current location and retrieve the weather for that location. You will need to approve location services through the request to see the API at work. Note that location services use your IP address so the results may vary especially if you are using a VPN or the ISP router is far away from your location. The map (retrieved via Google Maps API) shows the region, not your exact address as discussed earlier.
Location | {{api3.data.location.name}} |
---|---|
Region | {{api3.data.location.region}} |
Country | {{api3.data.location.country}} |
Local Time | {{api3.data.location.localtime.formatDate('dddd dd MMM yyyy HH:mm')}} |
Last Updated | {{api3.data.current.last_updated.formatDate('dddd dd MMM yyyy HH:mm')}} |
Temperature | {{api3.data.current.temp_c +'C '}} |
Feels Like | {{api3.data.current.feelslike_c +'C '}} |
Condition | {{api3.data.current.condition.text}} |
Wind | {{api3.data.current.wind_kph +'kmh from ' + api3.data.current.wind_dir}} |
Wind Gusts | {{api3.data.current.gust_kph +'kmh '}} |
Humidity | {{api3.data.current.humidity +'% '}} |
Rainfall | {{api3.data.current.precip_mm +' millimeters '}} |
UV Index | {{api3.data.current.uv}} |