Skip to content
The ๐Ÿ‡ฉ๐Ÿ‡ฟ API (Work in progress)
JavaScript
Branch: develop
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci ci: update circle config Nov 23, 2019
.vscode ๐ŸŽจ Algerianify .vscode Jun 1, 2019
deployment feat($api/db): add mongodb and mongoose schemas Jun 16, 2019
results feat($api): use xmlify Aug 24, 2019
server refactor($api): add test plugins Nov 23, 2019
tools fix: tools/package.json & tools/.snyk to reduce vulnerabilities Oct 6, 2019
.env.example feat($api/db): add mongodb and mongoose schemas Jun 16, 2019
.eslintrc.json refactor($api): add test plugins Nov 23, 2019
.gitignore refactor($api): add test plugins Nov 23, 2019
.snyk fix: .snyk & package.json to reduce vulnerabilities Oct 6, 2019
CONTRIBUTING.md ๐Ÿ“ add todos and guidelines for contributing Jun 15, 2019
LICENSE Create LICENSE Jun 2, 2019
Procfile
README.md feat($api): get wilaya by phone code Nov 21, 2019
jest.config.js test($server): setup tests with Jest Jun 1, 2019
nodemon-server.json ๐Ÿš€ setup server May 25, 2019
package.json refactor($api): add test plugins Nov 23, 2019
stryker.conf.js refactor($api): add test plugins Nov 23, 2019
test-utils.js test($api): test middlewares Nov 22, 2019
yarn.lock refactor($api): add test plugins Nov 23, 2019

README.md

Algeria API

Known Vulnerabilities Mutation testing badge

A list of Algerian Wilayas, Dairas and Baladyahs.

Features

API Documentation

  • Get a list of all Wilayas GET https://localhost:3000/api/v1/wilaya

  • Get Wilaya's details: GET https://localhost:3000/api/v1/wilaya/matricule/:matricule, example:

    ~: curl -X GET -i http://localhost:3000/api/v1/wilaya/matricule/31
    
    # Response
    {
      "data": {
        "mattricule": 31,
        "name": "Oran",
        "name_ar": "ูˆู‡ุฑุงู†",
        "name_en": "Oran",
        "phoneCodes": [
          41
        ],
        "postalCodes": [
          31000,
          31001,
          ...
          31117,
          31118
        ],
        "dairats": [
          {
            "name": "AIN TURK",
            "name_ar": "AIN TURK",
            "name_en": "AIN TURK",
            "baladyiats": []
          },
          {
            "name": "ARZEW",
            "name_ar": "ARZEW",
            "name_en": "ARZEW",
            "baladyiats": []
          },
          ...
        ]
      }
    }
  • Get the adjacent (nearby wilayas)

    • Only wilaya codes /wilaya/adjacence/:matricule
    • Wilaya names /wilaya/adjacence/:matricule/names example response:
        {
        "data": {
          "names": [
            {
              "mattricule": 46,
              "name": "Ain Temouchent",
              "name_ar": "ุนูŠู† ุชู…ูˆุดู†ุช",
              "name_en": "Ain Temouchent"
            },
            {
              "mattricule": 22,
              "name": "Sidi Bel Abbes",
              "name_ar": "ุณูŠุฏูŠ ุจู„ุนุจุงุณ",
              "name_en": "Sidi Bel Abbes"
            },
            {
              "mattricule": 29,
              "name": "Mascara",
              "name_ar": "ู…ุนุณูƒุฑ",
              "name_en": "Mascara"
            },
            {
              "mattricule": 27,
              "name": "Mostaganem",
              "name_ar": "ู…ุณุชุบุงู†ู…",
              "name_en": "Mostaganem"
            }
          ],
          "mattricules": [
            46,
            22,
            29,
            27
          ]
        }
      }
    • Short format (only wilaya names in a language and their codes)

        {
          "data": {
            "names": [
              "ุนูŠู† ุชู…ูˆุดู†ุช",
              "ุณูŠุฏูŠ ุจู„ุนุจุงุณ",
              "ู…ุนุณูƒุฑ",
              "ู…ุณุชุบุงู†ู…"
            ],
            "mattricules": [
              46,
              22,
              29,
              27
            ]
          }
        }
  • You can get an XML result by adding a format=xml query parameter, example:

    • GET: http://localhost:3000/api/v1/wilaya/matricule/31?format=xml will return:
    <?xml version="1.0" encoding="UTF-8"?>
    <wilaya>
      <phoneCodes>
        <phoneCode>41</phoneCode>
      </phoneCodes>
      <postalCodes>
        <postalCode>31000</postalCode>
        <postalCode>31001</postalCode>
        ...
        <postalCode>31118</postalCode>
      </postalCodes>
      <adjacentWilayas>
        <adjacentWilaya>46</adjacentWilaya>
        <adjacentWilaya>22</adjacentWilaya>
        <adjacentWilaya>29</adjacentWilaya>
        <adjacentWilaya>27</adjacentWilaya>
      </adjacentWilayas>
      <mattricule>31</mattricule>
      <name>Oran</name>
      <nameAr>ูˆู‡ุฑุงู†</nameAr>
      <nameEn>Oran</nameEn>
      <dairats>
        <dairat>
          <baladyiats>
            <baladyiat>
              <code>3101</code>
              <name>ORAN</name>
              <nameAr>ูˆู‡ุฑุงู†</nameAr>
  • Get postal codes by Wilaya

  • Get wilaya by postal codes

  • Get Wilaya by phone code

    • GET: http://localhost:3000/wilaya/phone-codes?code=41 and for getting XML results http://localhost:3000/wilaya/phone-codes?code=41&format=xml
  • Healthcheck

    • GET: http://localhost:3000/healthcheck

Find the full documentation here.

TODOs & Future Improvements/Features

  • Add Tamazight Translation
  • Build a dashboard to manage/correct data
  • Match each postal code withe its provinces
  • Add long/latt cordinates
  • sqlite ?

Contributing

When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with us before making a change. And also, please make sure to read our guidelines for contributing

Improving the API (new features, bug fixes...)

๐Ÿ“ ๐Ÿณ ๐ŸŒ ๐Ÿ— ๐Ÿ› โšก๏ธ ๐Ÿ‘ท โœจ

If you want to work on the API server, just pull this repository then run npm install

To run the development server

npm run server:dev
# or
yarn server:dev

To run in Docker

npm run docker:prod
# Or
yarn docker:prod

Improving the Wilayas List (translations, corrections...)

๐Ÿ“ ๐ŸŒ ๐Ÿ— ๐Ÿ› โšก๏ธ ๐Ÿ‘ท โœจ

The wilaya models are auto-generated by crawling and by using the fine work of mohsenuss91/AlgerianAdministrativeDivision. If you want to contribute more by adding, correcting or improving the results... Please create an issue so we can discuss it, and then you just need to update the results on results/WilayaList.json

License

This project is licensed under the MIT License - see the LICENSE file for details

Acknowledgments

You canโ€™t perform that action at this time.