|
2 | 2 |
|
3 | 3 | [](https://snyk.io/test/github/Fcmam5/algeria-api) [](https://stryker-mutator.github.io) |
4 | 4 |
|
5 | | -A list of Algerian Wilayas, Dairas and Baladyahs. |
| 5 | +This is another Algerian administrative areas repository :smiley:. In this project we provide a structured JSON and XML data that can be found in [results/WilayaList.json](./results/WilayaList.json) and [[results/WilayaList.XML](./results/WilayaList.XML) or through our API: [https://algeria-api.herokuapp.com/api/v1/]() |
6 | 6 |
|
7 | 7 | ## Features |
8 | 8 |
|
9 | 9 | * Exposes a RESTful API |
10 | | -* GraphQL Endpoint |
11 | 10 | * JSON Files |
12 | 11 | * Postal codes by wilaya [results/postal-codes-results.json](./results/postal-codes-results.json) |
13 | 12 | * Wilayas list (with Dairas and Baladiyahs lists) [results/WilayaList.json](./results/WilayaList.json) |
14 | 13 |
|
15 | 14 | ## API Documentation |
16 | 15 |
|
17 | | -* Get a list of all Wilayas `GET https://localhost:3000/api/v1/wilaya` |
18 | | -* Get Wilaya's details: `GET https://localhost:3000/api/v1/wilaya/matricule/:matricule`, example: |
19 | | - |
20 | | - ```bash |
21 | | - ~: curl -X GET -i http://localhost:3000/api/v1/wilaya/matricule/31 |
22 | | - |
23 | | - # Response |
24 | | - { |
25 | | - "data": { |
26 | | - "mattricule": 31, |
27 | | - "name": "Oran", |
28 | | - "name_ar": "وهران", |
29 | | - "name_en": "Oran", |
30 | | - "phoneCodes": [ |
31 | | - 41 |
32 | | - ], |
33 | | - "postalCodes": [ |
34 | | - 31000, |
35 | | - 31001, |
36 | | - ... |
37 | | - 31117, |
38 | | - 31118 |
39 | | - ], |
40 | | - "dairats": [ |
41 | | - { |
42 | | - "name": "AIN TURK", |
43 | | - "name_ar": "AIN TURK", |
44 | | - "name_en": "AIN TURK", |
45 | | - "baladyiats": [] |
46 | | - }, |
47 | | - { |
48 | | - "name": "ARZEW", |
49 | | - "name_ar": "ARZEW", |
50 | | - "name_en": "ARZEW", |
51 | | - "baladyiats": [] |
52 | | - }, |
53 | | - ... |
54 | | - ] |
55 | | - } |
56 | | - } |
57 | | - ``` |
58 | | -* Get the adjacent (nearby wilayas) |
59 | | - * Only wilaya codes `/wilaya/adjacence/:matricule` |
60 | | - * Wilaya names `/wilaya/adjacence/:matricule/names` example response: |
61 | | - |
62 | | - ````json |
63 | | - { |
64 | | - "data": { |
65 | | - "names": [ |
66 | | - { |
67 | | - "mattricule": 46, |
68 | | - "name": "Ain Temouchent", |
69 | | - "name_ar": "عين تموشنت", |
70 | | - "name_en": "Ain Temouchent" |
71 | | - }, |
72 | | - { |
73 | | - "mattricule": 22, |
74 | | - "name": "Sidi Bel Abbes", |
75 | | - "name_ar": "سيدي بلعباس", |
76 | | - "name_en": "Sidi Bel Abbes" |
77 | | - }, |
78 | | - { |
79 | | - "mattricule": 29, |
80 | | - "name": "Mascara", |
81 | | - "name_ar": "معسكر", |
82 | | - "name_en": "Mascara" |
83 | | - }, |
84 | | - { |
85 | | - "mattricule": 27, |
86 | | - "name": "Mostaganem", |
87 | | - "name_ar": "مستغانم", |
88 | | - "name_en": "Mostaganem" |
89 | | - } |
90 | | - ], |
91 | | - "mattricules": [ |
92 | | - 46, |
93 | | - 22, |
94 | | - 29, |
95 | | - 27 |
96 | | - ] |
97 | | - } |
98 | | - } |
99 | | - ```` |
100 | | - * Short format (only wilaya names in a language and their codes) |
101 | | - |
102 | | - ```json |
103 | | - { |
104 | | - "data": { |
105 | | - "names": [ |
106 | | - "عين تموشنت", |
107 | | - "سيدي بلعباس", |
108 | | - "معسكر", |
109 | | - "مستغانم" |
110 | | - ], |
111 | | - "mattricules": [ |
112 | | - 46, |
113 | | - 22, |
114 | | - 29, |
115 | | - 27 |
116 | | - ] |
117 | | - } |
118 | | - } |
119 | | - ``` |
120 | | - |
121 | | -* You can get an XML result by adding a `format=xml` query parameter, example: |
122 | | - * GET: `http://localhost:3000/api/v1/wilaya/matricule/31?format=xml` will return: |
123 | | - |
124 | | - ```xml |
125 | | - <?xml version="1.0" encoding="UTF-8"?> |
126 | | - <wilaya> |
127 | | - <phoneCodes> |
128 | | - <phoneCode>41</phoneCode> |
129 | | - </phoneCodes> |
130 | | - <postalCodes> |
131 | | - <postalCode>31000</postalCode> |
132 | | - <postalCode>31001</postalCode> |
133 | | - ... |
134 | | - <postalCode>31118</postalCode> |
135 | | - </postalCodes> |
136 | | - <adjacentWilayas> |
137 | | - <adjacentWilaya>46</adjacentWilaya> |
138 | | - <adjacentWilaya>22</adjacentWilaya> |
139 | | - <adjacentWilaya>29</adjacentWilaya> |
140 | | - <adjacentWilaya>27</adjacentWilaya> |
141 | | - </adjacentWilayas> |
142 | | - <mattricule>31</mattricule> |
143 | | - <name>Oran</name> |
144 | | - <nameAr>وهران</nameAr> |
145 | | - <nameEn>Oran</nameEn> |
146 | | - <dairats> |
147 | | - <dairat> |
148 | | - <baladyiats> |
149 | | - <baladyiat> |
150 | | - <code>3101</code> |
151 | | - <name>ORAN</name> |
152 | | - <nameAr>وهران</nameAr> |
153 | | - ``` |
154 | | - |
155 | | -* Get postal codes by Wilaya |
156 | | -* Get wilaya by postal codes |
157 | | -* Get Wilaya by phone code |
158 | | - * GET: `http://localhost:3000/wilaya/phone-codes?code=41` and for getting XML results `http://localhost:3000/wilaya/phone-codes?code=41&format=xml` |
159 | | - |
160 | | -* Healthcheck |
161 | | - * GET: `http://localhost:3000/healthcheck` |
162 | | - |
163 | | -Find the full documentation [here](https://documenter.getpostman.com/view/6370698/SW12ywmH?version=latest). |
| 16 | +Find the full API documentation [here](https://documenter.getpostman.com/view/6370698/SW12ywmH?version=latest) (*Will be moved to a SWAGGER documentation*). |
164 | 17 |
|
165 | 18 | ## TODOs & Future Improvements/Features |
166 | 19 |
|
|
0 commit comments