Code Monkey home page Code Monkey logo

malaysia-api's Introduction

Malaysia API 🇲🇾

A REST API about states in Malaysia.

All information are obtained from Wikipedia.

If you have noticed some mistakes or bugs, or maybe you have any suggestions please create an issue.

This API is meant to be a read-only web API. It is intentional for files to be stored this way (json format) as it avoids using any database engine.

Introduction

The states and federal territories of Malaysia are the principal administrative divisions of Malaysia. Malaysia is a federation of 13 states (Negeri) and 3 federal territories (Wilayah Persekutuan).

11 states and 2 federal territories are located on the Malay Peninsula, collectively called Peninsular Malaysia (Semenanjung Malaysia) or West Malaysia. 2 states are on the island of Borneo, and the remaining federal territory consists of islands offshore of Borneo; they are collectively referred to as East Malaysia or Malaysian Borneo. Out of the 13 states in Malaysia, 9 are monarchies.

The aim of this API is to provide static information that will be consumed by other applications.

List of End Points

The current base url is https://jian.sh/malaysia-api

State / Federal Territories End Point Status
All /state/v1/all.json x Test
Johor /state/v1/johor.json x Test
Kedah /state/v1/kedah.json x Test
Kelantan /state/v1/kelantan.json x Test
Malacca /state/v1/malacca.json x Test
Negeri Sembilan /state/v1/negeri_sembilan.json x Test
Pahang /state/v1/pahang.json x Test
Penang /state/v1/penang.json x Test
Perak /state/v1/perak.json x Test
Perlis /state/v1/perlis.json x Test
Sabah /state/v1/sabah.json x Test
Sarawak /state/v1/sarawak.json x Test
Selangor /state/v1/selangor.json x Test
Terengganu /state/v1/terengganu.json x Test
Kuala Lumpur /state/v1/kuala_lumpur.json x Test
Labuan /state/v1/labuan.json x Test
Putrajaya /state/v1/putrajaya.json x Test

x indicates that the entry is completed.

Usage Example

curl https://jian.sh/malaysia-api/state/v1/selangor.json

would retrieve

{
  "name": "Selangor",
  "administrative_division": "State of Malaysia",
  "full_name_jawi": "سلاڠور دار الإحسان",
  "full_name": "Selangor Darul Ehsan",
  "jawi_name": "سلاڠور",
  "chinese_name_simplified": "雪兰莪",
  "chinese_name_traditional": "雪蘭莪",
  "tamil_name": "சிலாங்கூர்",
  "motto": "Dipelihara Allah",
  "anthem": "Duli Yang Maha Mulia",
  "coordinates": "3°20′N 101°30′E",
  "capital": "Shah Alam",
  "royal_capital": "Klang",
  "government_type": ["Parliamentary", "constitutional monarchy"],
  "government_sultan": "Sharafuddin",
  "chief_minister": "Amirudin Shari (PH-PKR)",
  "area": "8.104km2",
  "highest_elevation": "1,830 m (6,004 ft)",
  "population_total": "6,448,400",
  "population_demonym": "Selangorean / Selangorian",
  "human_development_index": "0.855 (very high)",
  "time_zone_summer": "UTC+8 (not observed)",
  "postal_code": ["40xxx to 48xxx", "63xxx, 640xx", "68xxx"],
  "calling_code": "03",
  "ISO_3166_code": "MY-10",
  "vehicle_registration": "B",
  "federated_into_fms": 1895,
  "japanese occupation": 1942,
  "accession_into_fom": "31 August 1957",
  "website": ["www.selangor.gov.my", "www.selangorku.com"],
  "description": "Selangor (/səˈlæŋər/; Malay: [s(ə)laŋo(r)]), also known by its Arabic honorific Darul Ehsan, or "Abode of Sincerity", is one of the 13 states of Malaysia. It is on the west coast of Peninsular Malaysia and is bordered by Perak to the north, Pahang to the east, Negeri Sembilan to the south and the Strait of Malacca to the west. Selangor surrounds the federal territories of Kuala Lumpur and Putrajaya, both of which were previously part of it. The state capital of Selangor is Shah Alam and its royal capital is Klang. Petaling Jaya and Subang Jaya received city status in 2006 and 2019, respectively. Selangor is one of four Malaysian states that contain more than one city with official city status; the others are Sarawak, Johor, and Penang. The state of Selangor has the largest economy in Malaysia in terms of gross domestic product (GDP), with RM 239.968 billion (roughly US$55.5 billion) in 2015, comprising 22.6% of the country's GDP. It is the most developed state in Malaysia; it has good infrastructure such as highways and transport, and has the largest population in Malaysia, a high standard of living and the lowest poverty rate in the country."
}

malaysia-api's People

Contributors

amimaro avatar amir1611 avatar araanbranco avatar arrowarchit avatar darwisabdrauf avatar evan1115 avatar evertcode avatar farhan-helmy avatar firdisml avatar frey0-0 avatar ismi-abbas avatar jesslyw avatar jianloong avatar kirsteend avatar kyziq avatar mannuel25 avatar mofirdaus avatar nasuhasri avatar naufalazim avatar pk21-praveen avatar prachiagarwal19 avatar rafik7704 avatar saravananselvamohan avatar xomute avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

malaysia-api's Issues

Adding of domestic abuse cases to each state

There is a fair amount of data available from the Malaysia Open Data website

It would be great if the number of domestic abuse cases be added to the API. The data itself can be obtained from here.

However, there might be some data missing or the information there might be incomplete. If so, these should be marked as "NA". Please note that the data should include the cases by each year. If the information doesn't exist, the information can be omitted.

Create state entry called Negeri Sembilan

Currently, it can be seen that, there is an entry at

https://github.com/JianLoong/malaysia-api/blob/main/state/v1/selangor.json which actually leads to this end point which is deployed via gh-pages.

So, a Negeri_Sembilan.json should be created which contains information with regards to the state Negeri Sembilan.

Information with regards to the state can be obtained here.

The JSON file should contain the information should have similar output with the Selangor.json. Please also remember that the JSON file should be valid. (Please use a JSON validator to ensure that it is a valid JSON file).

Update the all.json with more information.

Currently the file at /state/v1/all.json only consist of 4 information per state. The information here should be more complete based on the Wikipedia entry here.

So, the all.json needs to be updated with the remaining information which includes, the population, total area, license plate prefix, phone area code, abbreviation, ISO, FIPS, HDI, region, head of state and the head of the government.

Updating and adding of various flag and crest URL.

Currently, the flag and crest URLs of the various states point to the Wikipedia website entry. (Where the user can choose the download the SVG or PNG file).

This can be improved by adding the path to the image itself instead.

For example in the file state/v1/johor.json the

"flag_url" information is currenty

"https://en.wikipedia.org/wiki/Johor#/media/File:Flag_of_Johor.svg"

when it should be instead

"https://upload.wikimedia.org/wikipedia/commons/5/5a/Flag_of_Johor.svg"

This is the same as several other entries.

Besides that, several states are also missing this information including, Kedah, Kelantan and a few others.

Completion of various information regarding states.

Currently information regarding various states are incomplete.

For example, the results of the selangor.json here. is complete whereas the information for all other states like Johor is incomplete.

You can complete this by adding all the missing information in the specific JSON files.

Do remember to validate your JSON file to ensure it is valid.

Improvements and ideas

Currently, this repository only holds a limited amount of information.

However, its features and contents can be significantly improved upon.

I am open to potential ideas as well as data fields or enhancements that can be made to the repository. Feel free to discuss it here. If that feature seems like a neat feature, I will open an issue for that specific feature.

Happy coding and hacktoberfest. 👍

Adding of climate data to each states and federal territories.

Each state should have their own climate data. The climate data can be obtained in several ways.

  1. The first way is to slowly comb through the available open data located here. and add the data to each of the state accordingly.

or the easier way

  1. Use the climate data from the Wikipedia located here for Selangor.

The data for the climate should be able to clearly denote each year and month so that it is easily parsed.

Create entries for all remaining states and federal territories

Refer to here for each state and create a specific entry in the v1 directory.

Each state should have a complete entry and also their description.

For example, in this request, the accompanying description is also added in the data.

The current status of the end point are as follows.

State / Federal Territories End Point Status
All /state/v1/all.json x
Johor /state/v1/johor.json x
Kedah /state/v1/kedah.json x
Kelantan /state/v1/kelantan.json x
Malacca /state/v1/malacca.json
Negeri Sembilan /state/v1/negeri_sembilan.json x
Pahang /state/v1/pahang.json
Penang /state/v1/penang.json
Perak /state/v1/perak.json
Perlis /state/v1/perlis.json x
Sabah /state/v1/Sabah.json
Sarawak /state/v1/Sarawak.json
Selangor /state/v1/selangor.json x
Terengganu /state/v1/terengganu.json
Kuala Lumpur /state/v1/kuala_lumpur.json x
Labuan /state/v1/labuan.json x
Putrajaya /state/v1/putrajaya.json x

x denotes the data entry is completed.

Edit - Updated information

Adding of unemployment rate by state

There is a fair amount of data available from the Malaysia Open Data website

It would be great if the unemployment data for each state could be added to the API. The data itself can be obtained from here. However, there might be some data missing or the information there might be incomplete.

It is not needed to add all the years to the API but just for the year 2020.

URI paths and case sensitivity.

Currently there is an inconsistent naming convention with regards to the end points of the REST resources.

For example,

https://jianliew.me/malaysia-api/state/v1/selangor.json which uses a lowercase 's' leads to the that specific resource,

however, compared to

https://jianliew.me/malaysia-api/state/v1/Johor.json which uses an uppercase 'j' leads that resource and the

https://jianliew.me/malaysia-api/state/v1/johor.json leads to file not found.

Please note, that I would rather not use an url rewrite option. Changing all resources to use lower cases will be an easier fix. Please note that, you should also update the readme and etc so that the fix is consistent.

Create entry for Kedah.json

Currently, it can be seen that there is an entry at

https://github.com/JianLoong/malaysia-api/blob/main/state/v1/selangor.json which actually leads to this end point which deployed to gh-pages.

So, a Kedah.json should be created which contains information with regards to the state Kedah.

Information with regards to the state can be obtained here.

The JSON file should contain the information should have similar output with the Selangor.json. Please also remember that the JSON file should be valid. (Please use a JSON validator to ensure that it is a valid JSON file).

Edit - Fixed typos and grammar mistakes.

Add entries for all federal territories to all.json

Previously in #1 , states have been added but the federal territories have not been added.

Based on the Wikipedia entry here, please add the 3 federal territories to the all.json file.

The administrative division should be "Federal Territory of x" where x is depending on the information found on Wikipedia.

Add JSON information for all the 3 federal territories (Kuala Lumpur, Labuan and Putrajaya)

Currently, it can be seen that, there is an entry at

https://github.com/JianLoong/malaysia-api/blob/main/state/v1/selangor.json which actually leads to this end point.

So, a Labuan.json should be created which contains information with regards to the state of Labuan.

Information with regards to the state can be obtained here.

This applies to Kuala Lumpur and Putrajaya as well.

The JSON files should contain the information should have similar output with the Selangor.json. Please also remember that the JSON file should be valid. (Please use a JSON validator to ensure that it is a valid JSON file).

Adding of religion census data for each state and federal territories.

Each state should have its own religion census data obtained from open source information.

Since, the data available is limited, the information should be stored in a sensible way taking into account the year and % breakdown. So, that it can be easily parsed.

The data for the state Negeri Sembilan can be obtained from the Wikipedia entry here.

Adding end point structure for different languages.

Currently, all information is stored in the English language however, a more widely spoken language in Malaysia is Bahasa Malaysia or Bahasa Melayu. So, all entries should have a translated version in the national language itself.

All information with regards to the states can be found in the Wikipedia Bahasa Malaysia for example an entry for Selangor can be found here. essentially the BM entry of Wikipedia for the state of Selangor.

There are a few ways this can be approached either.

  1. Create more directories for example using endpoints like /malaysia-api/state/v1/en/selangor.json to denote that it would be in the English language and /malaysia-api/state/v1/zsm/selangor.json to denote that it would be in Bahasa Malaysia. With zsm denoting that it is standard Malay as per ISO specification here.. Basically, this way would involve creating a directory that house another set of JSON files in the Malay language.

  2. Introduce more fields into the JSON file itself and use _en and _zsm postfix to denote the language. So for example, instead of a single description string in the Selangor.json there would be two. One for the English description and another for the Malay description. (This just means, putting an extra description_zsm in the json file itself)

Both ways have their benefits and their disadvantages.

Notes.

It is indeed possible to use the Content-Negotiation strategy as mentioned here but it was decided not to do so.

30/09/2022 - Included notes regarding Content Negotiation as mentioned in the Stack Overflow post. Also edited post for clarity.

Adding of number active and inactive vehicles on road.

There is a fair amount of data available from the Malaysia Open Data website

It would be great if the number of vehicles on road can be added to the API. The data itself can be obtained from here. However, there might be some data missing or the information there might be incomplete. If so, these should be marked as "NA". Please note that there are two numbers, the number of active vehicles and the number of inactive vehicles.

Create entry for malacca.json

Currently, it can be seen that, there is an entry at

https://github.com/JianLoong/malaysia-api/blob/main/state/v1/selangor.json which actually leads to this end point.

So, for example, a malacca.json should be created which contains information with regards to the state of Malacca.

Information with regards to the state can be obtained here.

This should be applied to all the remaining states which does not have an entry, found at the readme or not present in the state directory.

The JSON file should contain the information should have similar output with the Selangor.json. Please also remember that the JSON file should be valid. (Please use a JSON validator to ensure that it is a valid JSON file).

If possible all remaining states are included into the repository so that #2 is resolved as well.

Edit - Updated to mention #2
Edit - Updated with regards to issue #23
Edit - Updated issue so that more data is added instead of single one at each time

Incorrect label for federal territory.

Previously in #14 and #17 which added information on Kuala Lumpur, Labuan and Putrajaya, the administrative division was incorrectly labeled as "State of Malaysia". They are however not considered to be states but as federal territories instead.

The correction would be as follows (for the administrative division)

Labuan - Federal Territory of Labuan
Kuala Lumpur - Federal Territory of Kuala Lumpur
Putrajaya - Federal Territory of Putrajaya

This will also line up the entries so that the data is similar to the ones in the all.json file.

Create entry for Kelantan.json

Currently, it can be seen that, there is an entry at

https://github.com/JianLoong/malaysia-api/blob/main/state/v1/selangor.json which actually leads to this end point which is deployed via gh-pages.

So, a Kelantan.json should be created which contains information with regards to the state of Kelantan.

Information with regards to the state can be obtained here.

The JSON file should contain the information should have similar output with the Selangor.json. Please also remember that the JSON file should be valid. (Please use a JSON validator to ensure that it is a valid JSON file).

Correction of data types in JSON data for the all.json end point

Currently most of the data types in the JSON data stores for certain numeric fields are string however, this should not be the case, these should be numbers instead.

Take a look at the state/v1/all.json file for example below. The population and total_area should be numbers instead of strings.

    {
        "administrative_division": "State of Malaysia",
        "state": "Johor",
        "capital": "Johor Bahru",
        "royal_capital": "Muar",
        "population": "3,794,000", <---------------- This should be number
        "total_area": "19,166",  <----------------       This should be number
        "licence_plate_prefix": "J",
        "phone_area_code": "07, 06 (Muar & Tangkak)",
        "abbreviation": "JHR",
        "ISO": "MY-01",
        "FIPS": "MY01",
        "HDI": "0.818",
        "region": "Peninsular Malaysia",
        "head_of_state": "Sultan",
        "head_of_goverment": "Menteri Besar"
    },

This should be corrected for all entries.

Updating and adding of various crest URL

This issue is related to #44

The flag URL has been fixed however, the "crest_url" which points to the Wikipedia website entry has not been addressed.

For example in the file state/v1/johor.json the

"crest_url" information is currenty

"https://en.wikipedia.org/wiki/Johor#/media/File:Coat_of_arms_of_Johor.svg"

when it should be instead

"https://upload.wikimedia.org/wikipedia/commons/thumb/6/60/Coat_of_arms_of_Johor.svg/1280px-Coat_of_arms_of_Johor.svg.png"

This is the same as several other entries.

Missing crest_url from other states should also be added to handle this issue.

Create entry for Perlis.json

Currently, it can be seen that, there is an entry at

https://github.com/JianLoong/malaysia-api/blob/main/state/v1/selangor.json which actually leads to this end point which is deployed via gh-pages.

So, a Perlis.json should be created which contains information with regards to the state Perlis.

Information with regards to the state can be obtained here.

The JSON file should contain the information should have similar output with the Selangor.json. Please also remember that the JSON file should be valid. (Please use a JSON validator to ensure that it is a valid JSON file).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.