---
# System prepended metadata

title: 通用項目

---

# 通用項目
## 國別/縣市/區域基本檔
Query Params:
|  欄位 | 型態  | 預設   | 說明  | 
|---|---|---|---|---|
| countryCode | String | TW | 國別代碼(city code)
| cityCode | String | Taipei | 縣市代碼(city code)

```url=
GET /common/country
```

Attribute | Description | IsRequired| Remark
-|-|-|-
id | number | true | Primary Key 
countryCode | String | true | 國別代碼(country code)
cityCode | String | true | 縣市代碼(city code)
regionCode | String | true | 區域代碼(region code)

Response (成功):
```json=
{
    "success": true,
    "totoal": 60,
    "data": [
        {
            "id": 1,
            "countryCode": "TW",
            "cityCode": "Taipei",
            "regionCode": "Beitou", //北投
        }, {
            "id": 2,
            "countryCode": "TW",
            "cityCode": "Taipei",
            "regionCode": "Shilin", //士林
        },
        ...
    ]
}
```

## 國別/縣市/區域GIS界線經緯度
* 暫時會以前端嵌入Json當作資料來源，有空餘時間再實作成後端(dynamic)

Query Params:
|  欄位 | 型態  | 預設   | 說明  | 
|---|---|---|---|---|
| countryCode | String | TW | 國別代碼(country code) (required)
| cityCode | String | Taipei | 縣市代碼(city code) (optional)

```url=
GET /common/country/gis/boundary
```

Attribute | Description | IsRequired| Remark
-|-|-|-
id | number | true | Primary Key 
countryCode | String | true | 國別代碼(city code)
cityCode | String | true | 縣市代碼(city code)
regionCode | String | true | 區域代碼(region code)
coordinates | int array | true | 經緯度陣列

Response (成功):
```json=
// Situation 1 ----- 國別代碼/縣市代碼都有填入的狀況下 (以"區"為最小單位) -----
{
    "success": true,
    "totoal": 160,
    "data": [
        {
            "id": 12001,
            "countryCode": "TW",
            "cityCode": "Taipei",
            "regionCode": "Beitou", //北投
            "coordinates": [
                [120.532349, 23.62172],
                [120.532351, 23.62179],
                [120.532361, 23.62201],
                .......
            ]
        }, {
            "id": 12002,
            "countryCode": "TW",
            "cityCode": "Taipei",
            "regionCode": "Shilin", //士林
            "coordinates": [
                [120.533342, 23.62818],
                [120.533351, 23.62838],
                [120.533359, 23.62828],
                .......
            ]
        },
        ...
    ]
}

// Situation 2 ----- 國別代碼有填入，縣市代碼則為空的狀態下，(以縣市為最小單位) -----
{
    "success": true,
    "totoal": 18,
    "data": [
        {
            "id": 15001,
            "countryCode": "TW",
            "cityCode": "Taipei",
            "regionCode": null,
            "coordinates": [
                [120.532349, 23.62172],
                [120.532351, 23.62179],
                [120.532361, 23.62201],
                .......
            ]
        }, {
            "id": 15002,
            "countryCode": "TW",
            "cityCode": "Taipei",
            "regionCode": null,
            "coordinates": [
                [120.533342, 23.62818],
                [120.533351, 23.62838],
                [120.533359, 23.62828],
                .......
            ]
        },
        ...
    ]
}
```