Explaining API

I haven’t explained anything in a while but today I’d like to explain the concept of the API, or Application Programming Interface. The audience are absolute beginners or people who say ‘wala akong alam sa computer’.

A lot of programmers are busy these days talking about this due to the virus. So this is a good time to learn this.

So for example you run a news website. Naturally you want the absolute latest COVID 19 data such as PUIs and PUMs, busiest hospitals, most infections per location and others. People who read your publication want to know when, where, ages, gender, fatalities, etc. Traditionally you would call or email the DOH or hospitals, ask, type or copy and publish. Of course that’s ridiculous as there would be challenges every step of the way. You can’t call or email because the lines would be busy. Even if you get through they will have to collate the info for you. Typing it down and publishing each time is too tedious. Besides the information changes quickly so by the time you publish it’s out of date.

The solution? APIs.

• The DOH has a team that collects all this information and publishes it both online and more importantly in a format that is universally readable by others. It is available here: https://www.doh.gov.ph/covid19tracker.
• The WHO’s API are here: https://www.who.int/data/gho/info/gho-odata-api
• There are a bunch of independent API collectors, such as this amazing one: https://apify.com/covid-19
• Here’s possibly the best one: https://covid-19-apis.postman.com/
• and another: https://apify.com/covid-19
• Here’s a Philippine news API: https://webhose.io/news-api/philippines-news-api
• And here’s a local one re-listing DOH information to keep the DOH website from crashing from too many visits: https://github.com/benhur07b/covid19ph-doh-data-dump…

News websites all over the world can automatically retrieve this data and publish it. In fact anyone with an app can do the same for personal use or for automatically publishing on their own blogs or social media. Not only can you read it you can collate and study it for analysis. It is literally a geek’s wet dream. In fact I am studying ‘web scraping’ or the ability to retrieve data from websites that DO NOT publish an API.

You see APIs being used by travel sites, which offer the lowest airfare and hotel rates because they have an app that ‘scrapes’ airline and hotel websites for their latest rates. It’s used in the retail, real estate, insurance, banking and finance and any other industry which deals with quick changing numbers like prices and statistics. If you publish anything on your website, it can be ‘scraped’ and entered into a database for comparing with other data. Once empowered with an API it will then be available to anyone with access to it.

This is why it is so important for the government to invest in IT and projects such as Open Data Philippines (https://data.gov.ph/) and OpenStat (http://openstat.psa.gov.ph/), and for individual government departments to share data openly via API. Unfortunately a highly politicized administration does not favor the free and open sharing of information as it runs counter to self serving agendas. This plus the sheer unwillingness to learn new things will always hinder these projects.

I hope I was able to teach something today, thanks for reading.

Leave a Comment

Scroll to Top