Retrieve COVID-19 Nationwide Level Cases
Make a GET request to https://covid-19.samsam123.name.my/api/cases
Query String :
date
You can retrieve
Latest / Custom Date / All data via the
date string.
Latest : date=latest
Custom Date : date=YYYY-MM-DD
All : date=all
Example :
Retrieving 28 December 2021 COVID-19 Cases Data :
https://covid-19.samsam123.name.my/api/cases?date=2021-12-28
Retrieving Latest COVID-19 Cases Data :
https://covid-19.samsam123.name.my/api/cases?date=latest
Retrieving All COVID-19 Cases Data :
https://covid-19.samsam123.name.my/api/cases?date=all
Retrieve COVID-19 State Level Cases
Make a GET request to https://covid-19.samsam123.name.my/api/state
Query String :
1. date
You can retrieve
Latest / Custom Date / All data via the
date string.
Latest : date=latest
Custom Date : date=YYYY-MM-DD
All : date=all
Example :
Retrieving 28 December 2021 COVID-19 Cases Data :
https://covid-19.samsam123.name.my/api/state?date=2021-12-28
Retrieving Latest COVID-19 Cases Data :
https://covid-19.samsam123.name.my/api/state?date=latest
Retrieving All COVID-19 Cases Data :
https://covid-19.samsam123.name.my/api/state?date=all
2. state After retrieving the
Custom Date / Latest data via the
date string , the JSON response will contains 13 states + 3 Federal Territories's data.
To specify the state data you want :
State : state=STATE_NAME
State Name List :
State |
Johor |
Kedah |
Kelantan |
Melaka |
Negeri Sembilan |
Pahang |
Perak |
Perlis |
Pulau Pinang |
Sabah |
Sarawak |
Selangor |
Terengganu |
W.P. Kuala Lumpur |
W.P. Labuan |
W.P. Putrajaya |
Example :
Retrieving 28 December 2021 Selangor COVID-19 Cases Data :
https://covid-19.samsam123.name.my/api/state?date=2021-12-28&state=Selangor
Retrieving Latest Selangor COVID-19 Cases Data :
https://covid-19.samsam123.name.my/api/state?date=latest&state=Selangor
Retrieve COVID-19 Death Cases
Make a GET request to https://covid-19.samsam123.name.my/api/death
Query String :
date
You can retrieve
Latest / Custom Date / All data via the
date string.
Latest : date=latest
Custom Date : date=YYYY-MM-DD
All : date=all
Example :
Retrieving 28 December 2021 COVID-19 Death Cases Data :
https://covid-19.samsam123.name.my/api/death?date=2021-12-28
Retrieving Latest COVID-19 Death Cases Data :
https://covid-19.samsam123.name.my/api/death?date=latest
Retrieving All COVID-19 Death Cases Data :
https://covid-19.samsam123.name.my/api/death?date=all
Retrieve COVID-19 State Level Deaths Cases
Make a GET request to https://covid-19.samsam123.name.my/api/death_state
Query String :
1. date
You can retrieve
Latest / Custom Date / All data via the
date string.
Latest : date=latest
Custom Date : date=YYYY-MM-DD
All : date=all
Example :
Retrieving 28 December 2021 COVID-19 Deaths Cases Data :
https://covid-19.samsam123.name.my/api/death_state?date=2021-12-28
Retrieving Latest COVID-19 Deaths Cases Data :
https://covid-19.samsam123.name.my/api/death_state?date=latest
Retrieving All COVID-19 Deaths Cases Data :
https://covid-19.samsam123.name.my/api/death_state?date=all
2. state After retrieving the
Custom Date / Latest data via the
date string , the JSON response will contains 13 states + 3 Federal Territories's data.
To specify the state data you want :
State : state=STATE_NAME
State Name List :
State |
Johor |
Kedah |
Kelantan |
Melaka |
Negeri Sembilan |
Pahang |
Perak |
Perlis |
Pulau Pinang |
Sabah |
Sarawak |
Selangor |
Terengganu |
W.P. Kuala Lumpur |
W.P. Labuan |
W.P. Putrajaya |
Example :
Retrieving 28 December 2021 Selangor COVID-19 Deaths Cases Data :
https://covid-19.samsam123.name.my/api/death_state?date=2021-12-28&state=Selangor
Retrieving Latest Selangor COVID-19 Deaths Cases Data :
https://covid-19.samsam123.name.my/api/death_state?date=latest&state=Selangor
Retrieve COVID-19 Vaccination Data
Make a GET request to https://covid-19.samsam123.name.my/api/vax
Query String :
date
You can retrieve
Latest / Custom Date / All data via the
date string.
Latest : date=latest
Custom Date : date=YYYY-MM-DD
All : date=all
Example :
Retrieving 28 December 2021 COVID-19 Vaccination Data :
https://covid-19.samsam123.name.my/api/vax?date=2021-12-28
Retrieving Latest COVID-19 Vaccination Data :
https://covid-19.samsam123.name.my/api/vax?date=latest
Retrieving All COVID-19 Vaccination Data :
https://covid-19.samsam123.name.my/api/vax?date=all
Retrieve COVID-19 Clusters Data
Make a GET request to https://covid-19.samsam123.name.my/api/clusters
Query String :
No query string required.
You can retrieve All data via this API.
Example :
Retrieving all COVID-19 Clusters Data :
https://covid-19.samsam123.name.my/api/clusters
Error Code
You will get an error if you didn't input the correct date with correct date format YYYY-MM-DD or the API can't find the date you input on CSV file of Ministry of Health - Malaysia.
Example :
Retrieving 31 November 2021 COVID-19 Vaccination Data which 31 November 2021 doesn't exist :
https://covid-19.samsam123.name.my/api/vax?date=2021-11-31 Retrieving 29 December 2021 COVID-19 Vaccination Data on 28 December 2021 which the data hasn't published to Ministry Of Health - Malaysia Github yet :
https://covid-19.samsam123.name.my/api/vax?date=2021-12-29 You will get an JSON string like this , HTTP Response Code remain
200 :
{"Status":"Fail","Message":"Could not find date provided! Please try again! Please try after midnight if you wanted to retrieve the latest data!"}
Rate Limit
Details :
Not more than 30 requests in 30 seconds per API endpoints. Equivalently as one requests per one second.
HTTP 429 Too Many Requests and a JSON string contains your IP Address , Total Call Requests in 30 seconds will be returned if you exceed the rate limit.Rate limit will be reset each 30 secondsRedis will calculate the total request from your IP Address in 30 seconds and determine is your IP Address hit the limit You are unlikely going to hit this rate limit.
Why? See Caching part.
Example :
Requesting Cases API Endpoint for 34 times in 30 seconds via IP Address 8.8.8.8
HTTP 429 Too Many Requests and a JSON string contains your IP Address , Total Call Requests in 30 seconds will be returned. JSON String :
{"Status":"Fail","Message":"Rate limit exceeded!","IP Address":"8.8.8.8","Total_Calls":"34","Period":30}
Caching
Details :
Cached via Nginx Reverse Proxy and Cloudflare
Cache will expired each 30 minutes for Nginx Reverse Proxy and 2 hours for Cloudflare Edge
Notice the x-cache and cf-cache-status header when requesting the API , returning MISS / EXPIRED means not cached or expired, returning HIT means cached.
Example :
Requesting Cases API Endpoint with no data cached by Nginx and Cloudflare :
Response Header :
x-cache: MISS
cf-cache-status: MISS
Requesting Cases API Endpoint with data cached by Nginx and Cloudflare :
Response Header :
x-cache: HIT
cf-cache-status: HIT
Requesting Cases API Endpoint with data cached by Nginx but not cached by Cloudflare :
Response Header :
x-cache: HIT
cf-cache-status: MISS