In the current world situation, all countries track new and existing cases of COVID-19. Some countries provide an API to access the latest data. Here is an API provided by Hong Kong’s department of health. Today we will learn how to display this data in our own application. Applies to version 10.4 of PHPRunner, ASPRunner.NET and ASPRunnerPro.
Creating the REST View
1. Lets see how we can display data for March 2020. We added a filter for ‘As of date’ field to show data that contains ’03/2020′ in this field (they use UK date format). Click ‘Get result’ and we will see both API query string and the data it returns.
2. Now, lets take a look at the URL:
https://api.data.gov.hk/v2/filter?q=%7B%22resource%22%3A%22http%3A%2F%2Fwww.chp.gov.hk%2Ffiles%2Fmisc%2Flatest_situation_of_reported_cases_wuhan_eng.csv%22%2C%22section%22%3A1%2C%22format%22%3A%22json%22%2C%22filters%22%3A%5B%5B1%2C%22ct%22%2C%5B%2203%2F2020%22%5D%5D%5D%7D
We can paste it to the web browser and get the same results in JSON fomat. Now it is the time to create a REST connection. The https://api.data.gov.hk/v2/ part of the URL is the main connection URL.
Continue Reading "Working with third-party REST API"