---
# System prepended metadata

title: 登入

---




# 登入

獲取token及user id供以下api使用
* [取得使用者資訊](#取得使用者資訊)
* [取得Group資訊](#取得Group資訊)
* [取得Tenant裡的device](#取得Tenant裡的device)
* [取得VideoRecording的紀錄](#取得VideoRecording的紀錄)
* [下載VideoRecording](#下載VideoRecording)
* [取得VideoInfo](#取得VideoInfo)
* [取得DeviceGPS](#取得DeviceGPS)
* [取得Device的串流影音資訊](#取得Device的串流影音資訊)
* [取得DeviceEvent的紀錄](#取得DeviceEvent的紀錄)
* [取得tenant裡的notification的紀錄](#取得tenant裡的notification的紀錄)
* [取得tenant底下所有人的資訊](#取得tenant底下所有人的資訊)

Request URL
---
```
POST /api/login/web
```

Request Body Param
---
| 欄位     | 型態   | 說明 |
| -------- | ------ | ---- |
| account  | string | 帳號 |
| password | string | 密碼 |

Request Body Example
---
```
{
    "account": "cina",
    "password": "HiThere",
}
```

Response Body Param
---
| 欄位         | 型態      | 說明            |
| ------------ | --------- | --------------- |
| expiresIn    | timestamp | token到期日     |
| refreshToken | string    | 用來取得新token |
| userId       | string    | 使用者id        |
| userToken    | string    | 認證身份的token |





**Response Body Example**
---

```
{
  "httpCode": 200,
  "result": {
    "data": {
        "expiresIn": "631ee4e8-69cf-4163-3c0e-74d25cbf4c7c",
        "refreshToken": "Uje06fwuXx4cxf3v2IGxKsUz2zRmOEoDDiRzonhTSsCkROvVhZBsU0aGGg4ts23T"
        "userId": "cina_yeh_web",
        "userToken": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJBSU9UIiwicGVybWlzc2lvbnMiOlsiQ09MRF9DSEFJTiIsIlBFUk1JU1NJT05fTUdNIiwiQUNDT1VOVF9NR00iLCJERVZJQ0VfVFlQRV9NR00iLCJERVZJQ0VfTUdNIiwiRklSTVdBUkVfTUdNIiwiR1JPVVBTX0RFVklDRV9NR00iLCJTVEFGRklOR19NR00iLCJNT0JJTEVfREVWSUNFX01HTSIsIkRFVklDRV9DT05GSUciLCJBSVJfT1RBX01HTSIsIkRFVklDRV9NQVAiLCJURU5BTlRfTUdNIl0sInVzZXJBY2NvdW50IjoiY2luYV95ZWhfd2ViIiwiaXNzIjoiV2lzdHJvbiBTV1BDIiwidGVuYW50SWQiOiI0MTc0MmJiYS04YWYzLTQzZDQtYTI5Ny1kYmRhYTY2MGNiNDQiLCJpc1ZlbmRvciI6ZmFsc2UsInVzZXJBY2NvdW50VHlwZSI6IldFQiIsImV4cCI6MTY3Nzg3MTMwOSwidXNlcklkIjoiNjMxZWU0ZTgtNjljZi00NjEzLThjN2UtMTRkNjBjYmY0YzdjIiwiaWF0IjoxNjc3ODI4MTA5LCJqdGkiOiJlOWI4MWM4My1hOGU0LTRmMzUtOTRkZi1hMmY3NDI3YTk1Y2IifQ.Xal3eKT9i0TrcNjSpxV-MB4sl9IZI5GWH1WD2v-abeYHTLdcqgU7sHXvLZXupm9jhmltQoL9Aj7DNUOuVyz6u9r7GFVj_IzUfjlEqZMM_0MjNupH1pmOIOK-utCluBNo7O71CM7ekX78lKltsNuFRjplIhXyPJH61qhE8x7eZ-eoivGbBtFAzepBSzXFN3Xk3h6D7Qz2dp39bM8HSuj4lPPUe-u_x0qRt93wz8Jj8FFZbKjlt0qPXhSjorhPNpAzbj8MtfCJt6q1MbFozmd0Ty6zqbKCbYjE-HqgXJgEmjd09p1_7eKnybPECyRXqKPkPWd_N5gFd2nha0WmJbPz0-M_Z4OshclMo2g52l0knNOQE9XYY-DDVGeV2rjAkB58LHSSB5mBKwpJtAoeIEkB9EQRR_q4_JWjY1oZ6HA7CzZElYXSTRe02bvQPJ967ntxvJE6ZF5duXH9Uw5Q_ooGSJ2HGjDOqLIKLWcabobk4X7uGQnwB3tr-kQrev4bQdM56za2rZUpODjI2Lz11ZtHzKkssboX1_CUNLejuC2lhSmunxDT-Q-rpwPGufc8niFidbfqerMO8B58xwmHeI1OY7eLjXyVJiLR_Czr3fGoNhn51jxsB5UEhUU39LQ67UXLMiGNi4Icd3rXyAKBeyUb0WgjcH8OTtU1jilzs609ugo",
    }
  }
}
```


**Error Response Body**
---
| httpCode | errorMsg                                   | errorMsg describe |
| -------- | ------------------------------------------ | ----------------- |
| 422      | SERVICE_ERROR.ACCOUNT_NOT_EXISTS           | 帳號不存在        |
| 422      | SERVICE_ERROR.ACCOUNT_NOT_ENABLED          | 帳號未啟用        |
| 422      | SERVICE_ERROR.ACCOUNT_OR_PASSWORD_IS_EMPTY | 帳號或密碼為空    |
| 422      | SERVICE_ERROR.PASSWORD_ERROR               | 密碼錯誤          |
| 422      | SERVICE_ERROR.TENANT_NOT_ENABLED           | 組織未啟用        |
| 422      | SERVICE_ERROR.SYSTEM_ERROR                 | 不明系統錯誤      |

**Error Response Body Example**
---
```
{
  "errorMsg": "SERVICE_ERROR.ACCOUNT_NOT_EXISTS",
  "httpCode": 422
}
```

# 取得使用者資訊

**Request url**
---
```
POST /api/tenant-account/get
```


**Query Param**


| 欄位  | 型態 | 說明 |
| -------- | -------- | -------- |
| userId   | string     | 帳號id，唯一值     |

```
{
    "userId": "594bcf8d-a134-4efd-9366-392b8194e631"
}
```

**Response Body Param**
---



| 欄位        | 型態         | 說明                              |
| ----------- | ------------ | --------------------------------- |
| accountType | string       | 帳號型態                          |
| birthDate   | Text         | 生日                              |
| email1      | Text         | 使用者主要電子信箱                |
| gender      | int          | 性別 1:男性/2:女性                |
| roleList    | string array | 角色陣列                          |
| status      | bool         | 啟用狀態, true: 啟用, false: 停用 |
| tenantId    | Text         | Text                              |
| tenantName  | string       | 組織名稱                          |
| updateTime  | timestamp    | 最後更新時間                      |
| userAccount | string       | 帳號名稱                          |
| userId      | string       | 帳號 id                           |
| userName    | string       | 姓名                              |




**Response Body Example**
---

```
{
  "httpCode": 200,
  "result": {
    "data": {
        "userId": "631ee4e8-69cf-4163-3c0e-74d25cbf4c7c",
        "accountType": "WEB"
        "userAccount": "cina_yeh_web",
        "userName": "cina_w",
        "gender": 1,
        "birthDate": 1642608000000,
        "tenantId": "41742bba-8af3-43d4-a297-dbdaa660cb55",
        "tenantName": "WiBASE",
        "status": true,
        "email1": "cina@wibase.com",
        "updateTime": 1610588709000,
        "roleList": [
            {
                "roleId":"3487ccd-343mm0e-dcwer03-4434",
                "roleName": "Wibase_admin",
                "roleNo": "R002",
                "permissionList": ["TENANT_MGM","PERMISSION_MGM"]
            }, 
        ]
    }
  }
}
```

**Error Response Body**
---


| httpCode | errorMsg                         | errorMsg describe         |
| -------- | -------------------------------- | ------------------------- |
| 400      | API_ERROR.ARGUMENT_ERROR         | 參數錯誤                  |
| 401      | API_ERROR.UNAUTHORIZED           | 使用者未登入或Token已過期 |
| 422      | SERVICE_ERROR.ACCOUNT_NOT_EXISTS | user id 不存在            |

**Error Response Body Example**
---
```
{
  "errorMsg": "SERVICE_ERROR.ACCOUNT_NOT_EXISTS",
  "httpCode": 422
}
```


# 取得Group資訊


**Request URL**
---
```
GET /api/groups
```

**Response Body Param**
---



| 欄位     | 型態   | 說明      |
| -------- | ------ | --------- |
| id       | string | group id  |
| name     | string | group名稱 |
| children | Text   | 附屬group |




**Response Body Example**
---

```
[
   {
      "id":"e88920ff-37c9-4c1d-93e8-9a2afb9a7e1d",
      "name":"QS",
      "children":[]
   },
]
```

**Error Response Body**
---


| httpCode | errorMsg                 | errorMsg describe         |
| -------- | ------------------------ | ------------------------- |
| 400      | API_ERROR.ARGUMENT_ERROR | 參數錯誤                  |
| 401      | API_ERROR.UNAUTHORIZED   | 使用者未登入或Token已過期 |

**Error Response Body Example**
---
```
{
  "errorMsg": "SAPI_ERROR.UNAUTHORIZED",
  "httpCode": 401
}
```


# 取得Tenant裡的device

透過[取得Group資訊](#取得Group資訊)，來獲得group id


**Request URL**
---
```
POST /api/deviceMgmt/getTenantDevice
```

Request Body Param
---
| 欄位  | 型態 | 說明 |
| -------- | -------- | -------- |
| account   | string     | 帳號     |
| password   | string     | 密碼   |

Request Body Example
---
```
{
    "groupId": "e88920ff-37v7-2g5d-24e8-9a2afb9a7e1d",
}
```

**Response Body Param**
---

| 欄位        | 型態   | 說明             |
| ----------- | ------ | ---------------- |
| userId      | string | 使用者id         |
| userName    | string | 使用者名稱       |
| userAccount | string | 使用者帳號名稱   |
| tenantId    | string | tenand id        |
| tenantName  | string | tenant名字       |
| rentList    | string | 租借了多少台裝置 |
| deviceId    | string | 裝置id           |
| deviceType  | string | 裝置類型         |
| groupId     | string | group id         |
| camCount    | int    | camera 數量      |




**Response Body Example**
---

```
[
   {
      "userId":"f22f70d3-d335-4b7b-a21c-9a3cb7b184d0",
      "userName":"SQM",
      "userAccount":"SQM",
      "tenantId":"41742bba-8af3-43d4-a297-dbdaa660cb44",
      "tenantName":"WiBASE",
      "rentList":[
         {
            "deviceId":"WC-Q2010-002327",
            "deviceType":"Body-worn-camera",
            "groupId":"e88920ff-37c9-4c1d-93e8-9a2afb9a7e1d",
            "camCount":1
         }
      ]
   },
]
```

**Error Response Body**
---


| httpCode | errorMsg                 | errorMsg describe         |
| -------- | ------------------------ | ------------------------- |
| 400      | API_ERROR.ARGUMENT_ERROR | 參數錯誤                  |
| 401      | API_ERROR.UNAUTHORIZED   | 使用者未登入或Token已過期 |

**Error Response Body Example**
---
```
{
  "errorMsg": "SAPI_ERROR.UNAUTHORIZED",
  "httpCode": 401
}
```

# 取得VideoRecording的紀錄

需先透過[取得Tenant裡的device](#取得Tenant裡的device)、[取得Group資訊](#取得Group資訊)，來得到deviceIdList, userIdList, tenantId

**Request URL**
---
```
POST /api/map/getRecordingsList
```

Request Body Param
---
| 欄位         | 型態      | 說明                  |
| ------------ | --------- | --------------------- |
| pagination   | object    | 分頁                  |
| query        | object    | query條件             |
| current      | int       | 當前頁數              |
| pageSize     | int       | 每頁最多多少筆資料    |
| camNoList    | int       | 第幾顆鏡頭            |
| deviceIdList | list      | device list           |
| endTime      | timestamp | 結束時間              |
| searchType   | string    | 搜尋類別              |
| startDate    | string    | 開始日期              |
| startTime    | timestamp | 開始時間              |
| stopDate     | string    | 結束日期              |
| tenantId     | string    | group的id             |
| userIdList   | string    | user list             |
| sorter       | object    | 排序條件              |
| field        | string    | 根據哪個field來做排序 |
| order        | string    | 升序、降序            |


Request Body Example
---
```
{
   "query":{
      "searchType":"VIDEO",
      "startDate":"2022-01-31T16:00:00.000Z",
      "stopDate":"2023-03-07T15:59:59.999Z",
      "tenantId":"41320d11-e6a5-4586-b197-2de4715c261a",
      "deviceIdList":[
         "WC-Q2010-002152"
      ],
      "camNoList":[
         0
      ],
      "userIdList":[
         "417b6a9a-ba04-4e04-ade5-4dfaa3a32533"
      ],
      "startTime":1643644800000,
      "endTime":1678204799999
   },
   "pagination":{
      "current":1,
      "pageSize":10
   },
   "sorter":{
      "filed": "",
      "oreder": "desc",
   }
}
```

**Response Body Param**
---



| 欄位       | 型態   | 說明        |
| ---------- | ------ | ----------- |
| id         | string | re          |
| userName   | string | 使用者名稱  |
| userId     | string | 使用者Id    |
| deviceId   | string | device id   |
| camNo      | string | tenant名字  |
| createdAt  | string | 建立時間    |
| source     | string | 來源        |
| pagination | string | 分頁        |
| current    | string | 當前頁數    |
| pageSize   | int    | page數量    |
| total      | int    | 當前頁數有幾筆資料        |
| sorter     | int    | 排序條件        |
| total      | int    | 總共幾筆資料 |




**Response Body Example**
---

```
{
   "httpCode":200,
   "result":{
      "data":[
         {
            "id":"86d4bb8c-d0f9-480e-96b4-0d5d06e38bb6",
            "userName":"DQA",
            "userId":"4b8d2c90-772d-482f-9dbc-198bf3d15c1b",
            "deviceId":"WC-Q2010-004943",
            "camNo":"0",
            "createdAt":1670390241000,
            "source":"UpLoading"
         },
      ],
      "pagination":{
         "current":1,
         "pageSize":10,
         "total":7
      },
      "sorter":{},
      "total":7
   }
}
```

**Error Response Body**
---


| httpCode | errorMsg                 | errorMsg describe         |
| -------- | ------------------------ | ------------------------- |
| 400      | API_ERROR.ARGUMENT_ERROR | 參數錯誤                  |
| 401      | API_ERROR.UNAUTHORIZED   | 使用者未登入或Token已過期 |

**Error Response Body Example**
---
```
{
  "errorMsg": "SAPI_ERROR.UNAUTHORIZED",
  "httpCode": 401
}
```


# 下載VideoRecording

需先透過[取得Recordings list](#取得VideoRecording的紀錄)，得到videoId

**Request URL**
---
```
POST /api/device-management/recordings/{videoId}/origin
```

Request URL Param
---
| 欄位    | 型態   | 說明     |
| ------- | ------ | -------- |
| videoId | string | video id |

**Response Body Param**
---
```
https://dernoiwfno3q6.cloudfront.net/wizkloud-vod/WC-Q2010-002327/WC-Q2010-002327_2e31dcea-f7ef-4a85-bb62-128912287966/202210281656_2995.mp4?Policy=eyJTdGF0ZW1lbnQiOiBbeyJSZXNvdXJjZSI6Imh0dHBzOi8vZDN0NDh0MXdqbWE5cTYuY2xvdWRmcm9udC5uZXQvd2l6a2xvdWQtdm9kL1dDLVEyMDEwLTAwMjMyNy9XQy1RMjAxMC0wMDIzMjdfMmUzMWRjZWEtZjdlZi00YTg1LWJiNjIt3fp3mo43omf3p2LzIwMjIxMDI4MTY1Nl8yOTk1Lm1wNCIsIkNvbmRpdGlvbiI6eyJEYXRlTGVzc1RoYW4iOnsiQVdTOkVwb2NoVGltZSI6MTY3ODE2OTQ0Nn19fV19&Signature=mV9llyRHPsp7I10gbLeSqMvywgdhj~gCL2HimYqkeedhMPVk9XvsztL8RLYl42E97NyG3n1IqQfL-qvTG9P5l9NPUhgw4-JdGRj4K-rz73WlJIvNr7J3w9MjpME~Cd~FhLHf4xwi1ZKhU5To9DHAC1jFEVA~RvkUxb7eK0xC1Pn1cotnIO8AUC0hgVfSFJlS0Ox1qA6pq3LrXAa6rubXFIVBY2C~rbwfxw-RrwRGzMi3H0ueTRzK4ziClYS3ybUdgaubUL-y-NsveuneW7fslZAdDADfGWY5PFl1HRtmXv7-9ghIO5O9Ie4pom3f3p43f43f35U3SyPZg2zVp~Sg__&Key-Pair-Id=K3M80B96BD6RC7
```

**Error Response Body**
---


| httpCode | errorMsg                 | errorMsg describe         |
| -------- | ------------------------ | ------------------------- |
| 400      | API_ERROR.ARGUMENT_ERROR | 參數錯誤                  |
| 401      | API_ERROR.UNAUTHORIZED   | 使用者未登入或Token已過期 |

**Error Response Body Example**
---
```
{
  "errorMsg": "SAPI_ERROR.UNAUTHORIZED",
  "httpCode": 401
}
```


# 取得VideoInfo
需先透過[取得Recordings list](#取得VideoRecording的紀錄)，得到videoId


**Request URL**
---
```
POST /api/device-management/recordings/{videoId}/vedioInfo
```

Request URL Param
---
| 欄位    | 型態   | 說明     |
| ------- | ------ | -------- |
| videoId | string | video id |


**Response Body Param**
---

| 欄位          | 型態      | 說明           |
| ------------- | --------- | -------------- |
| source        | string    | 來源           |
| size          | int       | 檔案大小       |
| startTime     | timestamp | 開始時間       |
| duration      | float     | 錄了多久       |
| recodingUuid  | string    | recording uuid |
| fileExtension | string    | 檔案類型       |


**Response Body Example**
---

```
{
   "httpCode":200,
   "result":{
      "data":{
         "source":"Recording",
         "size":15958728,
         "startTime":1666947450000,
         "duration":59498.0,
         "recodingUuid":"bc6c1e52-ef3b-4b9c-9d45-32e474ceb6fd",
         "fileExtension":".mp4"
      }
   }
}
```

**Error Response Body**
---


| httpCode | errorMsg                 | errorMsg describe         |
| -------- | ------------------------ | ------------------------- |
| 400      | API_ERROR.ARGUMENT_ERROR | 參數錯誤                  |
| 401      | API_ERROR.UNAUTHORIZED   | 使用者未登入或Token已過期 |

**Error Response Body Example**
---
```
{
  "errorMsg": "SAPI_ERROR.UNAUTHORIZED",
  "httpCode": 401
}
```


# 取得DeviceGPS

**Request URL**
---

```
POST /api/map/gnss/list
```


Request Body Param
---

| 欄位       | 型態      | 說明      |
| ---------- | --------- | --------- |
| query      | object    | query條件 |
| deviceId   | string    | device id  |
| start      | timestamp | 開始時間  |
| end        | timestamp | 結束時間  |
| pagination | object    | 分頁  |
| current    | int       | 當前的頁數  |
| pageSize   | int       | 每頁最多多少筆資料  |
| sorter     | object    | 排序條件  |



**Request Body Example**
---

```
{
   "query":{
      "deviceId":"WC-Q2010-002327",
      "start":1666947450000,
      "end":1666947509498
   },
   "pagination":{
      "current":1,
      "pageSize":10
   },
   "sorter":{
   }
}
```


**Response Body Param**
---

| 欄位      | 型態      | 說明      |
| --------- | --------- | --------- |
| deviceId  | string    | device Id |
| coords    | object    | 位置      |
| latitude  | float     | 緯度      |
| longitude | float     | 經度      |
| altidude  | float     | 高度      |
| timestamp | timestamp | 所在的時間點  |


**Response Body Example**
---

```
{
   "httpCode":200,
   "result":{
      "data":[
         {
            "deviceId":"WC-Q2010-002327",
            "coords":{
               "latitude":25.0581351,
               "longitude":121.6125134,
               "altidude":282.118042
            },
            "timestamp":1666947501000
         }
      ]
   }
}
```



**Error Response Body**
---


| httpCode | errorMsg                 | errorMsg describe         |
| -------- | ------------------------ | ------------------------- |
| 400      | API_ERROR.ARGUMENT_ERROR | 參數錯誤                  |
| 401      | API_ERROR.UNAUTHORIZED   | 使用者未登入或Token已過期 |

**Error Response Body Example**
---

```
{
  "errorMsg": "SAPI_ERROR.UNAUTHORIZED",
  "httpCode": 401
}
```

# 取得Device的串流影音資訊
需先透過[取得Recordings list](#取得VideoRecording的紀錄)，得到videoId

**Request URL**
---

```
POST /api/device-management/recordings/{videoId}/vod
```

Request URL Param
---
| 欄位    | 型態   | 說明     |
| ------- | ------ | -------- |
| videoId | string | video id |


**Response Body Param**
---

| 欄位      | 型態      | 說明      |
| --------- | --------- | --------- |
| url  | string    | 串流url |
| signature    | string    | 串流signature      |
| keyPairId  | string     | 串流keyPairId      |
| policy | string     | policy     |


**Response Body Example**
---

```
{
   "httpCode":200,
   "result":{
      "data":{
         "url":"https://fpwvw8t1wjma9q6.cloudfront.net/wizkloud-vod/WC-Q2010-002327/WC-Q2010-009988_2e31dcea-f7ef-4a85-bb62-128912287966/output/202210281656_2995.m3u8",
         "signature":"KqnFdz5Wdsi-IHmnwrRDEW1HZ6OkR6U6ZpfjKOCferowgXt437ZznsqAL6duGnqLMl6jgWRBIxtGPpFDP9rnXexBfjvFaJLbnRThaqBsTnFmS0C57dFPYdSXhNlLKHVGnukmQLtrsiGCG-NfwppOZjik80N6K8xeQo89s1XvLaEo7uWa3gjaqsL4,vxp71Zv3aUGn2ot8sMjbi19AHAL0Y2Ht1r2nTwuxrxu3oVRRGcqOFlmZwYq2zzxkIuiRgBy6WlV-pKufaReMDMb2Vt1HSciAPDdaxLbiq2N4p0nVkH-YHHGEFI~MNCxFJckC19XwXfkKDtqTygHYCAMKTbbr0A__",
         "keyPairId":"K3M80B9we5D6RC7",
         "policy":"eyJTdGF0ZW1lbnQiOiBbeywebpwNvdXJjZSI6Imh0dHBzOi8vZDN0NDh0MXdqbWE5cTYuY2xvdWRmcm9udC5uZXQvd2l6a2xvdWQtdm9kL1dDLVEyMDEwLTAwMjMyNy9XQy1RMjAxMC0wMDIzMjdfMmUzMWRjZWEtZjdlZi00YTg1LWJiNjItMTI4OTEyMjg3OTY2L291dHB1dC8qIiwiQ29uZGl0aW9uIjp7IkRhdGVMZ2obwGhhbiI6eyJBV1M6RXBvY2hUaW1lIjoxNjc4MjU0MDQyfX19XX0_"
      }
   }
}
```



**Error Response Body**
---


| httpCode | errorMsg                 | errorMsg describe         |
| -------- | ------------------------ | ------------------------- |
| 400      | API_ERROR.ARGUMENT_ERROR | 參數錯誤                  |
| 401      | API_ERROR.UNAUTHORIZED   | 使用者未登入或Token已過期 |

**Error Response Body Example**
---

```
{
  "errorMsg": "SAPI_ERROR.UNAUTHORIZED",
  "httpCode": 401
}
```








# 取得DeviceEvent的紀錄

需先透過[取得Tenant裡的device](#取得Tenant裡的device)、[取得Group資訊](#取得Group資訊)，來得到deviceIdList, userIdList, tenantId

**Request URL**
---

```
POST api/map/getEventList
```

Request Body Param
---
| 欄位         | 型態         | 說明                  |
| ------------ | ------------ | --------------------- |
| query        | object       | query條件             |
| searchType   | string       | 搜尋類別              |
| startDate    | string       | 開始日期              |
| stopDate     | string       | 結束日期              |
| tenantId     | string       | tenant id             |
| deviceIdList | list(string) | device id             |
| userIdList   | list(string) | user id               |
| startTime    | timestamp    | 開始時間              |
| endTime      | timestamp    | 結束時間              |
| pagination   | ojbect       | 分頁                  |
| current      | int          | 當前頁數              |
| pageSize     | int          | 每頁最多多少筆資料    |
| sorter       | object       | 排序條件              |
| field        | string       | 根據哪個field來做排序 |
| order        | string       | 升序、降序            |



**Request Body Example**
---

```
{
   "query":{
      "searchType":"EVENT",
      "startDate":"2022-02-28T16:00:00.000Z",
      "stopDate":"2023-03-07T15:59:59.999Z",
      "tenantId":"e88920ff-37c9-4c1d-93e8-9a2afb9a7e1d",
      "deviceIdList":[
         "WC-Q2010-003796"
      ],
      "userIdList":[
         "e6076a02-14b1-4e74-9e7b-e864e6552cbf",
         "f22f70d3-d335-4b7b-a21c-9a3cb7b184d0",
         "4b8d2c90-772d-482f-9dbc-198bf3d15c1b"
      ],
      "startTime":1646064000000,
      "endTime":1678204799999
   },
   "pagination":{
      "current":1,
      "pageSize":10
   },
   "sorter":{}
}
```

**Response Body Param**
---

| 欄位       | 型態   | 說明                  |
| ---------- | ------ | --------------------- |
| userId     | string | user id               |
| userName   | string | username              |
| deviceId   | string | deviceId              |
| eventTime  | string | 事件觸發時間          |
| eventLevel | string | 事件等級              |
| eventTitle | string | 事件名稱              |
| isRecorded | string | 是否recorded          |
| latitude   | string | 緯度                  |
| longitude  | string | 經度                  |
| pagination | object | 分頁條件              |
| current    | int    | 當前頁數              |
| pageSize   | int    | 每頁最多多少筆資料    |
| total      | int    | 當前頁數有幾筆資料    |
| sorter     | object | 排序條件              |
| field      | string | 根據哪個filed來做排序 |
| order      | string | 升序、降序            |
| total      | int    | 總共幾筆資料          |


**Response Body Example**
---

```
{
   "httpCode":200,
   "result":{
      "data":[
         {
            "userId":"e6076a02-14b1-4e74-9e7b-e864e6552cbf",
            "userName":"RMA",
            "deviceId":"WC-Q2010-003796",
            "eventTime":1663122641401,
            "eventLevel":"High",
            "eventTitle":"SOS",
            "isRecorded":false,
            "latitude":"25.05793411575587",
            "longitude":"121.6384537402821"
         }
      ],
      "pagination":{
         "current":1,
         "pageSize":10,
         "total":1
      },
      "sorter":{
         
      },
      "total":1
   }
}
```



**Error Response Body**
---


| httpCode | errorMsg                 | errorMsg describe         |
| -------- | ------------------------ | ------------------------- |
| 400      | API_ERROR.ARGUMENT_ERROR | 參數錯誤                  |
| 401      | API_ERROR.UNAUTHORIZED   | 使用者未登入或Token已過期 |

**Error Response Body Example**
---

```
{
  "errorMsg": "SAPI_ERROR.UNAUTHORIZED",
  "httpCode": 401
}
```

# 取得tenant裡的notification的紀錄

需先透過[取得使用者資訊](#取得使用者資訊)來獲得tenantId

**Request URL**
---

```
GET /api/notification/{tenantId}
```

Request URL Param
---
| 欄位     | 型態   | 說明      |
| -------- | ------ | --------- |
| tenantId | string | tenant id |


**Response Body Param**
---

| 欄位                 | 型態      | 說明                  |
| -------------------- | --------- | --------------------- |
| id                   | string    | event id              |
| deviceId             | string    | device id             |
| msgId                | string    | msgId                 |
| notificationType     | string    | notification 類型代稱 |
| eventTimestamp       | timestamp | 觸發時間              |
| groupName            | string    | 觸發人員所在的group   |
| groupId              | string    | group id              |
| userName             | string    | 觸發人員的名字        |
| notificationTypeName | string    | notification 類型名稱 |


**Response Body Example**
---

```
{
   "httpCode":200,
   "result":{
      "data":[
         {
            "id":"4b042049-ecf1-4541-90c5-8340d3ae7010",
            "deviceId":"WD-Q2030-001184",
            "msgId":"uuid",
            "notificationType":"S",
            "eventTimestamp":1678141291148,
            "groupName":"SW",
            "groupId":"4fb9fcb2-25dd-4184-b5d0-ebc32bebf4e1",
            "userName":"YC",
            "notificationTypeName":"SOS"
         },...
      ]
    }
}
```



**Error Response Body**
---


| httpCode | errorMsg                 | errorMsg describe         |
| -------- | ------------------------ | ------------------------- |
| 400      | API_ERROR.ARGUMENT_ERROR | 參數錯誤                  |
| 401      | API_ERROR.UNAUTHORIZED   | 使用者未登入或Token已過期 |

**Error Response Body Example**
---

```
{
  "errorMsg": "SAPI_ERROR.UNAUTHORIZED",
  "httpCode": 401
}
```



# 取得tenant底下所有人的資訊

需先透過[取得使用者資訊](#取得使用者資訊)來獲得tenantId

**Request URL**
---

```
GET /api/notification/mapping/{tenantId}
```

Request URL Param
---
| 欄位     | 型態   | 說明      |
| -------- | ------ | --------- |
| tenantId | string | tenant id |


**Response Body Param**
---

| 欄位        | 型態      | 說明                  |
| ----------- | --------- | --------------------- |
| accountId   | string    | 帳號名稱id             |
| accountName | string    | 帳號名稱             |
| tenantId    | string    | 使用者所在的tenant id                |
| tenantName  | string    | 使用者所在的tenant |
| groupId     | timestamp | 使用者所在的group id              |
| groupName   | string    | 使用者所在的group name   |


**Response Body Example**
---

```
{
   "httpCode":200,
   "result":{
      "data":[
         {
            "accountId":"c11c6b6f-2159-44b2-8001-a65c975526ad",
            "accountName":"Erica",
            "tenantId":"41742bba-8af3-43d4-a297-dbdaa660cb44",
            "tenantName":"WiBASE",
            "groupId":"9d3701b1-8317-466c-9546-245f945293ed",
            "groupName":"WiZAVIU 1"
         }....
      ]
   }
}
```



**Error Response Body**
---


| httpCode | errorMsg                 | errorMsg describe         |
| -------- | ------------------------ | ------------------------- |
| 400      | API_ERROR.ARGUMENT_ERROR | 參數錯誤                  |
| 401      | API_ERROR.UNAUTHORIZED   | 使用者未登入或Token已過期 |

**Error Response Body Example**
---

```
{
  "errorMsg": "SAPI_ERROR.UNAUTHORIZED",
  "httpCode": 401
}
```