--- title: Pokedom 對接 API V1.5 --- 目錄 [TOC] --- 修訂紀錄 | 版本 | 更新日期 | 内容 | | - | - | - | | 1.0 | 2020/06/01 | 初版 | | 1.1 | 2020/06/05 | 登入、交易接口整合、通知 API 排版修改 | | 1.2 | 2020/06/08 | Poke管理 API、測試紀錄API 改成查詢原始資料 | | 1.3 | 2020/06/10 | 共用API的部分,改成分開獨立,通知API加入說明,錯誤代碼數字修改 | | 1.4 | 2020/06/18 | poke 查詢、新增、修改 出入參數格式盡量統一、測試紀錄回傳參數名稱修改 | | 1.5 | 2020/06/22 | 新增批量測試API、回傳狀態代碼修改 | --- # 1. 驗證 使用 Pokedom 系統需先註冊帳戶。 與Pokedom API 溝通時要先取得 `Access Token` 並在 Request Heads 添加 `Access Token` 才能呼叫第 2、3、4、5 章節的 API。 ## 1.1. 回傳 API 正確時且有回傳值 Response 以下格式內容。 | Parameter | Description| | ----------- | -------- | | statusCode | 交易狀態碼 | | message | 詳細訊息 | | returnObject | 回應Json資料 | ```json= { "statusCode": "1000", "message": "", "returnObject": {"data":"test"} } ``` API 發生錯誤時 Response 以下格式內容。 | Parameter | Description| | ----------- | -------- | | statusCode | 交易狀態碼 | | message | 詳細訊息 | | returnObject | 回應Json資料 | ```json= { "statusCode": "2000", "message": "請求參數錯誤", "returnObject": {} } ``` ## 1.2. 註冊 Pokedom 帳戶 * URL: `/api/partner/register` * Method: `POST` * ContentType: `application/json` **Request** | Parameter | Type | Require | Description| | ----------- | -------- | -------- | -----------| | name | string | Yes | 名稱| | surname | string | Yes | 姓氏| | user_name | string | Yes | 用戶名| | email_address | string | Yes | 電子郵件| | password | string | Yes | 用戶密碼 (大小寫英+數字+符號,最長32字元)| ```json= { "name": "testacct", "surname": "testacct", "user_name": "testacct", "email_address": "testacct@Email.com", "password": "#testPwd" } ``` **Response** 無 --- ## 1.3. Access Token * URL: `/api/partner/authenticate` * Method: `POST` * ContentType: `application/json` **Request** | Parameter | Type | Require | Description| | ----------- | -------- | -------- | -----------| | user_name_or_email_address | string | Yes | 用戶名或電子郵件| | password | string | Yes | 用戶密碼| ```json= { "user_name_or_email_address": "testacct", "password": "testacct" } ``` **Response** | Parameter | Type | Require | Description| | ----------- | -------- | -------- | -----------| | access_token | string | Yes | 存取權杖| | expire_in_seconds | int | Yes | 有效秒數| ```json= { "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOlsiNCIsIjQiXSwibmFtZSI6Iktlbm5ldGhUZXN0Vjk5IiwiQXNwTmV0LklkZW50aXR5LlNlY3VyaXR5U3RhbXAiOiJRSFJFTkFUVTJaVTdNWkQ2NE5ZM0NQRzVHTldTRVpTTyIsInJvbGUiOiJHcGtNZXJjaGFudCIsImh0dHA6Ly93d3cuYXNwbmV0Ym9pbGVycGxhdGUuY29tL2lkZW50aXR5L2NsYWltcy90ZW5hbnRJZCI6IjEiLCJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1lIjoiS2VubmV0aFRlc3RWOTkiLCJqdGkiOiIwZWMzYjJiZi01ODk0LTQzN2YtOGQzNi0yODlkYjc5NmYzMjAiLCJpYXQiOjE1NzEzMDE1NjQsIm5iZiI6MTU3MTMwMTU2NCwiZXhwIjoxNTcxMzg3OTY0LCJpc3MiOiJNeU1pbmUiLCJhdWQiOiJNeU1pbmUifQ.Pe8k9yuwvcMNVM5ZMYq-QY_lGyVZb1nYX0SY5r24JDM", "expires_in_seconds": 1800 } ``` --- # 2. Poke 管理 API 本章節 API 需要使用 `交易 Token` 才能進行呼叫 (詳情請看`驗證`章節說明)。 ## 2.1. 回傳 API 正確時且有回傳值 Response 以下格式內容。 | Parameter | Description| | ----------- | -------- | | statusCode | 交易狀態碼 | | message | 詳細訊息 | | returnObject | 回應Json資料 | ```json= { "statusCode": "1000", "message": "", "returnObject": {"data":"test"} } ``` API 發生錯誤時 Response 以下格式內容。 | Parameter | Description| | ----------- | -------- | | statusCode | 交易狀態碼 | | message | 詳細訊息 | | returnObject | 回應Json資料 | ```json= { "statusCode": "2000", "message": "請求資料錯誤", "returnObject": {} } ``` --- ## 2.2. 查詢 Poke * URL: `/api/poke` * Method: `GET` * ContentType: `application/json` **Request** | Parameter | Type | Require | Description| | ----------- | -------- | -------- | -----------| | search | string | No | Poke 名字 | | tags | string[] | No | Poke 標籤 | ```json= { "search": "test" "tags": ["test1","test2"], } ``` **Response** | Parameter | Type | Require | Description| | ----------- | -------- | -------- | -----------| | pokes | object[] | Yes | Pokes 資料 | > ***pokes*** > | Parameter | Type | Require | Description | > | ----------- | -------- | -------- | ----------- | > | uid | guid | Yes | Poke ID | > | status | string | Yes | Poke 目前狀態 ( 固定值 : up、warning、down、pause、unknown ) | > | name | string | Yes | Poke 名字 | > | domain | string | Yes | Poke 網址 ( 不包含http協定 ) | > | protocol | string | Yes | http協定 ( 固定值: http、https、空值 ) | > | port | int? | Yes | 埠號 | > | tags | string[] | Yes | 標籤 | > | setting | object | Yes | 網址週期測試設定 | > | periodTestIsEnabled | bool | Yes | 是否啟用 ( true : 啟用, false : 停止 )| > > ***setting*** > >| Parameter | Type | Require | Description | > >| ----------- | -------- | -------- | ----------- | > >| checkInterval | int | Yes | 測試週期性時間 ( 固定值 : 10、15、20、30、60 ) | > >| timeoutSecond | long | Yes | 網站檢查過期時間 ( 固定值 : 30、60、90、120、150、180、210、240、270、300 ) | > >| resendCycle | int | Yes | 網站連續檢測錯誤時,間隔次數通知使用者 ( 固定值 : 10、20、30、40、50 ) | > >| customizeMessage | string | Yes | 錯誤通知內容 | > >| useMobileUserAgent | bool | Yes | 是否使用手機檢測 | > >| contentCheck | string | Yes | 檢測網站內容 | > >| headerCheck | object[] | Yes | 檢測Header參數 ( 最多5組 ) | > > > ***headerCheck*** > > >| Parameter | Type | Require | Description | > > >| ----------- | -------- | -------- | ----------- | > > >| name | string | Yes | Header Key 名字 | > > >| value | string | Yes | Header value 參數 | ```json= { "pokes": [ { "uid": "2b5cdeed-777c-43d8-8e69-e2a5a95eddb0", "status": "up", "name": "test", "domain": "google.com", "protocol": "http", "port": null, "tags": ["test"], "setting": { "checkInterval": 30, "timeoutSecond": 150, "resendCycle": 30, "customizeMessage": "test", "useMobileUserAgent": false, "contentCheck": "test", "headerCheck": [{"name": "test", "value": "test"}] }, "periodTestIsEnabled": true } ] } ``` --- ## 2.3. 新增 Poke * URL: `/api/poke` * Method: `POST` * ContentType: `application/json` **Request** | Parameter | Type | Require | Description| | ----------- | -------- | -------- | -----------| | name | string | No | Poke 名字 | | protocol | string | No | http協定 ( 固定值: http、https、空值 ) | | domain | string | Yes | 網址 ( 不含http協定 ) | | port | int? | No | 埠號 | | tags | string[] | No | 標籤 ( 最多100個 ) | | setting | object | Yes | 網址週期測試設定 | > ***setting*** > | Parameter | Type | Require | Description | > | ----------- | -------- | -------- | ----------- | > | checkInterval | int | Yes | 測試週期性時間 ( 固定值 : 10、15、20、30、60 ) | > | timeoutSecond | long | Yes | 網站檢查過期時間 ( 固定值 : 30、60、90、120、150、180、210、240、270、300 ) | > | resendCycle | int | Yes | 網站連續檢測錯誤時,間隔次數通知使用者 ( 固定值 : 10、20、30、40、50 ) | > | customizeMessage | string | Yes | 錯誤通知內容 | > | useMobileUserAgent | bool | Yes | 是否使用手機檢測 | > | contentCheck | string | Yes | 檢測網站內容 | > | headerCheck | object[] | No | 檢測Header參數 ( 最多5組 ) | > >***headerCheck*** > >| Parameter | Type | Require | Description| > >| ----------- | -------- | -------- | -----------| > >| name | string | No | Header Key 名字 | > >| value | string | No | Header value 參數 | ```json= { "name": "test", "protocol": "http", "domain": "google.com", "port": null, "tags": ["test"], "setting": { "checkInterval": 30, "timeoutSecond": 150, "resendCycle": 30, "customizeMessage": "test", "useMobileUserAgent": false, "contentCheck": "test", "headerCheck": [{"name": "test", "value": "test"}] } } ``` **Response** | Parameter | Type | Require | Description | | ----------- | -------- | -------- | ----------- | | uid | guid | Yes | Poke ID | | status | string | Yes | Poke 目前狀態 ( 固定值 : up、warning、down、pause、unknown ) | | name | string | Yes | Poke 名字 | | domain | string | Yes | Poke 網址 ( 不包含http協定 ) | | protocol | string | Yes | http協定 ( 固定值: http、https、空值 ) | | port | int? | Yes | 埠號 | | tags | string[] | Yes | 標籤 | | setting | object | Yes | 網址週期測試設定 | | periodTestIsEnabled | bool | Yes | 是否啟用 ( true : 啟用, false : 停止 )| > ***setting*** >| Parameter | Type | Require | Description | >| ----------- | -------- | -------- | ----------- | >| checkInterval | int | Yes | 測試週期性時間 ( 固定值 : 10、15、20、30、60 ) | >| timeoutSecond | long | Yes | 網站檢查過期時間 ( 固定值 : 30、60、90、120、150、180、210、240、270、300 ) | >| resendCycle | int | Yes | 網站連續檢測錯誤時,間隔次數通知使用者 ( 固定值 : 10、20、30、40、50 ) | >| customizeMessage | string | Yes | 錯誤通知內容 | >| useMobileUserAgent | bool | Yes | 是否使用手機檢測 | >| contentCheck | string | Yes | 檢測網站內容 | >| headerCheck | object[] | Yes | 檢測Header參數 ( 最多5組 ) | > > ***headerCheck*** > >| Parameter | Type | Require | Description | > >| ----------- | -------- | -------- | ----------- | > >| name | string | Yes | Header Key 名字 | > >| value | string | Yes | Header value 參數 | ```json= { "uid": "2b5cdeed-777c-43d8-8e69-e2a5a95eddb0", "status": "up", "name": "test", "protocol": "http", "domain": "google.com", "port": null, "tags": ["test"], "setting": { "checkInterval": 30, "timeoutSecond": 150, "resendCycle": 30, "customizeMessage": "test", "useMobileUserAgent": false, "contentCheck": "test", "headerCheck": [{"name": "test", "value": "test"}] }, "periodTestIsEnabled": true } ``` --- ## 2.4. 修改 Poke * URL: `/api/poke` * Method: `PUT` * ContentType: `application/json` **Request** | Parameter | Type | Require | Description | | ----------- | -------- | -------- | ----------- | | uid | guid | Yes | Poke ID | | name | string | No | Poke 名字 | | protocol | string | No | http協定 ( 固定值: http、https、空值 ) | | domain | string | Yes | 網址 ( 不含http協定 ) | | port | int? | No | 埠號 | | tags | string[] | No | 標籤 ( 最多100個 ) | | setting | object | Yes | 網址週期測試設定 | > ***setting*** > | Parameter | Type | Require | Description | > | ----------- | -------- | -------- | ----------- | > | checkInterval | int | Yes | 測試週期性時間 ( 固定值 : 10、15、20、30、60 ) | > | timeoutSecond | long | Yes | 網站檢查過期時間 ( 固定值 : 30、60、90、120、150、180、210、240、270、300 ) | > | resendCycle | int | Yes | 網站連續檢測錯誤時,間隔次數通知使用者 ( 固定值 : 10、20、30、40、50 ) | > | customizeMessage | string | Yes | 錯誤通知內容 | > | useMobileUserAgent | bool | Yes | 是否使用手機檢測 | > | contentCheck | string | Yes | 檢測網站內容 | > | headerCheck | object[] | No | 檢測Header參數 ( 最多5組 ) | > >***headerCheck*** > >| Parameter | Type | Require | Description| > >| ----------- | -------- | -------- | -----------| > >| name | string | No | Header Key 名字 | > >| value | string | No | Header value 參數 | ```json= { "uid": "2b5cdeed-777c-43d8-8e69-e2a5a95eddb0", "name": "test", "protocol": "http", "domain": "google.com", "port": null, "tags": ["test"], "setting": { "checkInterval": 30, "timeoutSecond": 150, "resendCycle": 30, "customizeMessage": "test", "useMobileUserAgent": false, "contentCheck": "test", "headerCheck": [{"name": "test", "value": "test"}] } } ``` **Response** 無 --- ## 2.5. 刪除 Poke * URL: `/api/poke` * Method: `DELETE` * ContentType: `application/json` **Request** | Parameter | Type | Require | Description| | ----------- | -------- | -------- | -----------| | uid | guid[] | Yes | Poke ID | ```json= { "uid": [ "2b5cdeed-777c-43d8-8e69-e2a5a95eddb0", "3b5cdded-777c-43d8-8e69-e2a5a95eddb0" ] } ``` **Response** 無 --- ## 2.6. 啟用 Poke * URL: `/api/poke/unpause` * Method: `PUT` * ContentType: `application/json` **Request** | Parameter | Type | Require | Description| | ----------- | -------- | -------- | -----------| | uid | guid[] | Yes | Poke ID | ```json= { "uid": [ "2b5cdeed-777c-43d8-8e69-e2a5a95eddb0", "3b5cdded-777c-43d8-8e69-e2a5a95eddb0" ] } ``` **Response** 無 --- ## 2.7. 暫停 Poke * URL: `/api/poke/pause` * Method: `PUT` * ContentType: `application/json` **Request** | Parameter | Type | Require | Description| | ----------- | -------- | -------- | -----------| | uid | guid[] | Yes | Poke ID | ```json= { "uid": [ "2b5cdeed-777c-43d8-8e69-e2a5a95eddb0", "3b5cdded-777c-43d8-8e69-e2a5a95eddb0" ] } ``` **Response** 無 --- ## 2.8. 立即測試 Poke * URL: `/api/poke/test-now` * Method: `POST` * ContentType: `application/json` **Request** | Parameter | Type | Require | Description| | ----------- | -------- | -------- | -----------| | uid | guid | Yes | Poke ID | ```json= { "uid": "2b5cdeed-777c-43d8-8e69-e2a5a95eddb0" } ``` **Response** 無 --- # 3. 測試紀錄查詢 API 本章節 API 需要使用 `交易 Token` 才能進行呼叫 (詳情請看`驗證`章節說明)。 ## 3.1. 回傳 API 正確時且有回傳值 Response 以下格式內容。 | Parameter | Description| | ----------- | -------- | | statusCode | 交易狀態碼 | | message | 詳細訊息 | | returnObject | 回應Json資料 | ```json= { "statusCode": "1000", "message": "", "returnObject": {"data":"test"} } ``` API 發生錯誤時 Response 以下格式內容。 | Parameter | Description| | ----------- | -------- | | statusCode | 交易狀態碼 | | message | 詳細訊息 | | returnObject | 回應Json資料 | ```json= { "statusCode": "2000", "message": "請求資料錯誤", "returnObject": {} } ``` --- ## 3.2. 測試紀錄查詢 * URL: `/api/poke/test-logs` * Method: `GET` * ContentType: `application/json` **Request** | Parameter | Type | Require | Description| | ----------- | -------- | -------- | -----------| | uid | guid | Yes | Poke ID | | fromTime | long | Yes | 起 ( UTC Unix時間戳,毫秒 ) | | toTime | long | Yes | 訖 ( UTC Unix時間戳,毫秒 ) | ```json= { "uid": "2b5cdeed-777c-43d8-8e69-e2a5a65eddb0" "fromTime": 1589846400000, "toTime": 1590364800000 } ``` **Response** | Parameter | Type | Require | Description| | ----------- | -------- | -------- | -----------| | testlogs | object[] | Yes | 測試紀錄| > ***testlogs*** > | Parameter | Type | Require | Description| > | ----------- | -------- | -------- | -----------| > | resultKey | guid | Yes | 測試紀錄log ID | > | time | long | Yes | 測試時間 ( UTC Unix時間戳,毫秒 ) | > | status | string | Yes | 測試狀態 ( 固定值 : up、warning、down、unknown ) | > | avgResponseTime | int | Yes | 平均Response Time | > | nodeInfo | object | Yes | 測試記錄節點統計 | > > ***nodeInfo*** > >| Parameter | Type | Require | Description| > >| ----------- | -------- | -------- | -----------| > >| totalNode | long | Yes | 測試節點數量 | > >| successNode | long | Yes | 測試正常節點數量 | ```json= { "testlogs": [ { "resultKey": "2b5cdeed-777c-43d8-8e69-e2a5a65eddb0", "time": 1590364800000, "status": "up", "avgResponseTime": 340, "nodeInfo": { "totalNode": 7, "successNode": 6 } } ] } ``` --- ## 3.3. 測試紀錄明細查詢 * URL: `/api/poke/test-log-detail` * Method: `GET` * ContentType: `application/json` **Request** | Parameter | Type | Require | Description| | ----------- | -------- | -------- | -----------| | uid | guid | Yes | Poke ID | | resultKey | guid | Yes | 測試紀錄log ID | | time | long | Yes | 測試時間 ( UTC Unix時間戳,毫秒 ) | ```json= { "uid": "2b5cdeed-777c-43d8-8e69-e2a5a65eddb0" "resultKey": "6b5cdeed-777c-43d8-8e69-e2a5a65eddb0", "time": 1590364800000 } ``` **Response** | Parameter | Type | Require | Description| | ----------- | -------- | -------- | -----------| | testlogdetails | object[] | Yes | 測試紀錄明細 | > ***testlogdetails*** > | Parameter | Type | Require | Description| > | ----------- | -------- | -------- | -----------| > | uid | guid | Yes | Poke ID | > | resultKey | guid | Yes | 測試紀錄log ID | > | testTime | long | Yes | 測試時間 ( UTC Unix時間戳,毫秒 ) | > | status | string | Yes | 測試狀態 ( 固定值 : up、warning、down、unknown ) | > | requestTime | long | Yes | 實際請求測試時間 ( UTC Unix時間戳,毫秒 ) | > | expireTime | long | Yes | 測試容許時間 ( UTC Unix時間戳,毫秒 ) | > | url | string | Yes | 測試網址 | > | urlIp | string | Yes | 解析測試網址得到的IP | > | urlIpProvince | string | Yes | 解析IP所在地 | > | region | string | Yes | 監測點 ( 省分 ) | > | city | string | Yes | 監測點 ( 城市 ) | > | isp | string | Yes | 監測點 ( 電信商 ) | > | httpStatus | int? | Yes | http狀態碼 ( -1:無法測試、-2:節點維護 ) | > | redirectUrl | string | Yes | 轉址的網址 | > | responseTime | long? | Yes | 測試完成時間 ( UTC Unix時間戳,毫秒 ) | > | totalTime | int? | Yes | 總耗時 ( ms ) | > | dnsResolveTime | int? | Yes | 解析域名花費的時間 ( ms ) | > | tcpTime | int? | Yes | TCPING連結時間 ( ms ) | > | downloadTime | int? | Yes | 下載花費的時間 ( ms ) | > | downloadSize | int? | Yes | 實際下載的檔案大小 ( byte ) | > | fileSize | int? | Yes | 檔案大小 ( byte ) | > | specialContentCheck | string | Yes | 特定內容驗證結果 ( 固定值: 無、異常、正常、無法測試 ) | > | resultHeader1 | string | Yes | 第1組Header檢查結果 ( 固定值: 無、異常、正常、找不到此Header ) | > | resultHeader2 | string | Yes | 第2組Header檢查結果 ( 固定值: 無、異常、正常、找不到此Header ) | > | resultHeader3 | string | Yes | 第3組Header檢查結果 ( 固定值: 無、異常、正常、找不到此Header ) | > | resultHeader4 | string | Yes | 第4組Header檢查結果 ( 固定值: 無、異常、正常、找不到此Header ) | > | resultHeader5 | string | Yes | 第5組Header檢查結果 ( 固定值: 無、異常、正常、找不到此Header ) | ```json= { "testlogdetails": [ { "uid": "2b5cdeed-777c-43d8-8e69-e2a5a65eddb0", "resultKey": "6b5cdeed-777c-43d8-8e69-e2a5a65eddb0", "testTime": 1590364800000, "status": "up", "requestTime": 1590364850000, "expireTime": 1590364900000, "url": "google.com", "urlIp": "14.215.177.39", "urlIpProvince": "江苏省南京市 电信", "region": "江西", "city": "南昌", "isp": "电信", "httpStatus": 200, "redirectUrl": "https://google.com/", "responseTime": 1590364890000, "totalTime": 257, "dnsResolveTime": 1, "tcpTime": 20, "downloadTime": 143, "downloadSize": 60930, "fileSize": 60930, "resultHeader1": "無", "resultHeader2": "無", "resultHeader3": "無", "resultHeader4": "無", "resultHeader5": "無" } ] } ``` --- # 4. 通知設定 API 本章節 API 需要使用 `交易 Token` 才能進行呼叫 (詳情請看`驗證`章節說明)。 通知設定完成後,請先進行發送測試,確認設定是否成功。 ## 4.1. 回傳 API 正確時且有回傳值 Response 以下格式內容。 | Parameter | Description| | ----------- | -------- | | statusCode | 交易狀態碼 | | message | 詳細訊息 | | returnObject | 回應Json資料 | ```json= { "statusCode": "1000", "message": "", "returnObject": {"data":"test"} } ``` API 發生錯誤時 Response 以下格式內容。 | Parameter | Description| | ----------- | -------- | | statusCode | 交易狀態碼 | | message | 詳細訊息 | | returnObject | 回應Json資料 | ```json= { "statusCode": "2000", "message": "請求資料錯誤", "returnObject": {} } ``` --- ## 4.2. Email 通知 要新增 `Email 通知人員`,需要先新增 `Email 設定`, 才能進行新增。 ### 4.2.1. 查詢 Email 通知人員 * URL: `/api/notification-setting/email/list` * Method: `GET` * ContentType: `application/json` **Request** 無 **Response** | Parameter | Type | Require | Description| | ----------- | -------- | -------- | -----------| | settings | object[] | Yes | 通知設定列表 | | configs | object[] | Yes | 通知種類config設定列表 | | isTypeEnabled | bool | Yes | 通知種類是否啟用 | > ***settings*** > | Parameter | Type | Require | Description| > | ----------- | -------- | -------- | -----------| > | id | long | Yes | 通知設定 ID | > | configId | long | Yes | 通知種類config設定ID | > | recipient | int | Yes | 通知者名稱 | > | address | long | Yes | 通知地址 | > | isEnabled | guid | Yes | 是否啟用 | > ***configs*** > | Parameter | Type | Require | Description| > | ----------- | -------- | -------- | -----------| > | id | long | Yes | 通知種類config設定ID | > | name | string | Yes | 通知種類config設定名稱 | --- ### 4.2.2. 新增 Email 通知人員 * URL: `/api/notification-setting/email` * Method: `POST` * ContentType: `application/json` **Request** | Parameter | Type | Require | Description| | ----------- | -------- | -------- | -----------| | recipient | string | Yes | 通知者名稱 | | address | string | Yes | 通知地址 | | configId | long | Yes | 通知種類config設定ID | ```json= { "recipient": "測試人員01", "address": "abc@gmail.com", "configId": 1 } ``` **Response** 無 --- ### 4.2.3. 修改 Email 通知人員 * URL: `/api/notification-setting/email` * Method: `PUT` * ContentType: `application/json` **Request** | Parameter | Type | Require | Description| | ----------- | -------- | -------- | -----------| | id | long | Yes | 通知設定ID | | recipient | string | Yes | 通知者名稱 | | address | string | Yes | 通知地址 | | configId | long | Yes | 通知種類config設定ID | ```json= { "id": 123, "recipient": "測試人員01", "address": "abc@gmail.com", "configId": 1 } ``` **Response** 無 --- ### 4.2.4. 刪除 Email 通知人員 * URL: `/api/notification-setting/email` * Method: `DELETE` * ContentType: `application/json` **Request** | Parameter | Type | Require | Description| | ----------- | -------- | -------- | -----------| | id | long | Yes | 通知設定ID | ```json= { "id": 123 } ``` **Response** 無 --- ### 4.2.5. 查詢 Email 設定 * URL: `/api/notification-config/email/list` * Method: `GET` * ContentType: `application/json` **Request** 無 **Response** | Parameter | Type | Require | Description| | ----------- | -------- | -------- | -----------| | configs | object[] | Yes | 通知config設定列表 | > ***configs*** > | Parameter | Type | Require | Description| > | ----------- | -------- | -------- | -----------| > | id | long | Yes | config設定 ID | > | name | string | Yes | config設定名稱 | > | host | string | Yes | SMTP Host地址 | > | port | int | Yes | SMTP Host埠號 | > | account | string | Yes | SMTP 帳號 | > | password | string | Yes | SMTP 密碼 | > | fromEmail | string | Yes | SMTP 發件Email | --- ### 4.2.6. 新增 Email 設定 * URL: `/api/notification-config/email` * Method: `POST` * ContentType: `application/json` **Request** | Parameter | Type | Require | Description| | ----------- | -------- | -------- | -----------| | name | string | Yes | config設定名稱 | | host | string | Yes | SMTP Host地址 | | port | int | Yes | SMTP Host埠號 | | account | string | Yes | SMTP 帳號 | | password | string | Yes | SMTP 密碼 | | fromEmail | string | Yes | SMTP 發件Email | ```json= { "name": 設定01, "host": "smtp.gmail.com", "port": 465, "account": "account", "password": "password", "fromEmail": "fromEmail@gmail.com" } ``` **Response** 無 --- ### 4.2.7. 修改 Email 設定 * URL: `/api/notification-config/email` * Method: `PUT` * ContentType: `application/json` **Request** | Parameter | Type | Require | Description| | ----------- | -------- | -------- | -----------| | id | long | Yes | config設定 ID | | name | string | Yes | config設定名稱 | | host | string | Yes | SMTP Host地址 | | port | int | Yes | SMTP Host埠號 | | account | string | Yes | SMTP 帳號 | | password | string | Yes | SMTP 密碼 | | fromEmail | string | Yes | SMTP 發件Email | ```json= { "id": 465, "name": 設定01, "host": "smtp.gmail.com", "port": 465, "account": "account", "password": "password", "fromEmail": "fromEmail@gmail.com" } ``` **Response** 無 --- ### 4.2.8. 刪除 Email 設定 * URL: `/api/notification-config/email` * Method: `DELETE` * ContentType: `application/json` **Request** | Parameter | Type | Require | Description| | ----------- | -------- | -------- | -----------| | id | long | Yes | config設定 ID | ```json= { "id": 465 } ``` **Response** 無 --- ## 4.3. SMS 通知 要新增 `SMS 通知人員`,需要先新增 `SMS 設定`, 才能進行新增。 ### 4.3.1. 查詢 SMS 通知人員 * URL: `/api/notification-setting/sms/list` * Method: `GET` * ContentType: `application/json` **Request** 無 **Response** | Parameter | Type | Require | Description| | ----------- | -------- | -------- | -----------| | settings | object[] | Yes | 通知設定列表 | | configs | object[] | Yes | 通知種類config設定列表 | | isTypeEnabled | bool | Yes | 通知種類是否啟用 | > ***settings*** > | Parameter | Type | Require | Description| > | ----------- | -------- | -------- | -----------| > | id | long | Yes | 通知設定 ID | > | configId | long | Yes | 通知種類config設定ID | > | recipient | int | Yes | 通知者名稱 | > | address | long | Yes | 通知地址 | > | isEnabled | guid | Yes | 是否啟用 | > ***configs*** > | Parameter | Type | Require | Description| > | ----------- | -------- | -------- | -----------| > | id | long | Yes | 通知種類config設定ID | > | name | string | Yes | 通知種類config設定名稱 | --- ### 4.3.2. 新增 SMS 通知人員 * URL: `/api/notification-setting/sms` * Method: `POST` * ContentType: `application/json` **Request** | Parameter | Type | Require | Description| | ----------- | -------- | -------- | -----------| | recipient | string | Yes | 通知者名稱 | | address | string | Yes | 通知地址 | | configId | long | Yes | 通知種類config設定ID | ```json= { "recipient": "測試人員01", "address": "abc@gmail.com", "configId": 1 } ``` **Response** 無 --- ### 4.3.3. 修改 SMS 通知人員 * URL: `/api/notification-setting/sms` * Method: `PUT` * ContentType: `application/json` **Request** | Parameter | Type | Require | Description| | ----------- | -------- | -------- | -----------| | id | long | Yes | 通知設定ID | | recipient | string | Yes | 通知者名稱 | | address | string | Yes | 通知地址 | | configId | long | Yes | 通知種類config設定ID | ```json= { "id": 123, "recipient": "測試人員01", "address": "abc@gmail.com", "configId": 1 } ``` **Response** 無 --- ### 4.3.4. 刪除 SMS 通知人員 * URL: `/api/notification-setting/sms` * Method: `DELETE` * ContentType: `application/json` **Request** | Parameter | Type | Require | Description| | ----------- | -------- | -------- | -----------| | id | long | Yes | 通知設定ID | ```json= { "id": 123 } ``` **Response** 無 --- ### 4.3.5. 查詢 SMS 設定 * URL: `/api/notification-config/sms/list` * Method: `GET` * ContentType: `application/json` **Request** 無 **Response** | Parameter | Type | Require | Description| | ----------- | -------- | -------- | -----------| | configs | object[] | Yes | 通知config設定列表 | > ***configs*** > | Parameter | Type | Require | Description| > | ----------- | -------- | -------- | -----------| > | id | long | Yes | config設定 ID | > | name | string | Yes | config設定名稱 | > | provider | string | Yes | sms服務商 ( 固定值: twilio,nexmo,plivo,netease) | > | smsId | string | Yes | sms服務商提供的id、key欄位 | > | token | string | Yes | sms服務商提供的token、secret欄位 | > | templateId | string | Yes | netease特有的欄位 | > | fromNumber | string | Yes | sms發送來源號碼 | --- ### 4.3.6. 新增 SMS 設定 * URL: `/api/notification-config/sms` * Method: `POST` * ContentType: `application/json` **Request** | Parameter | Type | Require | Description| | ----------- | -------- | -------- | -----------| | name | string | Yes | config設定名稱 | | provider | string | Yes | sms服務商 ( 固定值: twilio,nexmo,plivo,netease) | | smsId | string | Yes | sms服務商提供的id、key欄位 | | token | string | Yes | sms服務商提供的token、secret欄位 | | templateId | string | No | netease特有的欄位 | | fromNumber | string | No | sms發送來源號碼 | ```json= { "name": "設定01", "provider": "twilio", "smsId": "ACfd148072a6728f5719a490f0ce77ce24", "token": "fc4eba55rd8f2d420638cj9c13895066", "templateId": "", "fromNumber": "+12036939361" } ``` **Response** 無 --- ### 4.3.7. 修改 SMS 設定 * URL: `/api/notification-config/sms` * Method: `PUT` * ContentType: `application/json` **Request** | Parameter | Type | Require | Description| | ----------- | -------- | -------- | -----------| | id | long | Yes | config設定 ID | | name | string | Yes | config設定名稱 | | provider | string | Yes | sms服務商 ( 固定值: twilio,nexmo,plivo,netease) | | smsId | string | Yes | sms服務商提供的id、key欄位 | | token | string | Yes | sms服務商提供的token、secret欄位 | | templateId | string | No | netease特有的欄位 | | fromNumber | string | No | sms發送來源號碼 | ```json= { "id": 465, "name": "設定01", "provider": "twilio", "smsId": "ACfd148072a6728f5719a490f0ce77ce24", "token": "fc4eba55rd8f2d420638cj9c13895066", "templateId": "", "fromNumber": "+12036939361" } ``` **Response** 無 --- ### 4.3.8. 刪除 SMS 設定 * URL: `/api/notification-config/sms` * Method: `DELETE` * ContentType: `application/json` **Request** | Parameter | Type | Require | Description| | ----------- | -------- | -------- | -----------| | id | long | Yes | config設定 ID | ```json= { "id": 465 } ``` **Response** 無 --- ## 4.4. Teams 通知 ### 4.4.1. 查詢 Teams 通知人員 * URL: `/api/notification-setting/teams/list` * Method: `GET` * ContentType: `application/json` **Request** 無 **Response** | Parameter | Type | Require | Description| | ----------- | -------- | -------- | -----------| | settings | object[] | Yes | 通知設定列表 | | isTypeEnabled | bool | Yes | 通知種類是否啟用 | > ***settings*** > | Parameter | Type | Require | Description| > | ----------- | -------- | -------- | -----------| > | id | long | Yes | 通知設定 ID | > | recipient | int | Yes | 通知者名稱 | > | address | long | Yes | 通知地址 | > | isEnabled | guid | Yes | 是否啟用 | --- ### 4.4.2. 新增 Teams 通知人員 * URL: `/api/notification-setting/teams` * Method: `POST` * ContentType: `application/json` **Request** | Parameter | Type | Require | Description| | ----------- | -------- | -------- | -----------| | recipient | string | Yes | 通知者名稱 | | address | string | Yes | 通知地址 | ```json= { "recipient": "測試人員01", "address": "https://outlook.office.com/webhook/2c3gsdf" } ``` **Response** 無 --- ### 4.4.3. 修改 Teams 通知人員 * URL: `/api/notification-setting/teams` * Method: `PUT` * ContentType: `application/json` **Request** | Parameter | Type | Require | Description| | ----------- | -------- | -------- | -----------| | id | long | Yes | 通知設定ID | | recipient | string | Yes | 通知者名稱 | | address | string | Yes | 通知地址 | ```json= { "id": 123, "recipient": "測試人員01", "address": "https://outlook.office.com/webhook/2c3gsdf" } ``` **Response** 無 --- ### 4.4.4. 刪除 Teams 通知人員 * URL: `/api/notification-setting/teams` * Method: `DELETE` * ContentType: `application/json` **Request** | Parameter | Type | Require | Description| | ----------- | -------- | -------- | -----------| | id | long | Yes | 通知設定ID | ```json= { "id": 123 } ``` **Response** 無 --- ## 4.5. Telegram 通知 新增 `Telegram 通知人員`,需要先透過 `Telegram 新增用 Token、QRcode` 取得 Token & QRcode ,其中 QRcode 已附帶 Token,透過 QRcode 跳轉到 Bot 直接點擊 start 即可完成綁定。 修改 `Telegram 通知人員`,需要先透過 `Telegram 修改用 Token、QRcode` 取得 Token & QRcode ,其中 QRcode 已附帶 Token,透過 QRcode 跳轉到 Bot 直接點擊 start 即可完成修改。 ### 4.5.1. 查詢 Telegram 通知人員 * URL: `/api/notification-setting/telegram/list` * Method: `GET` * ContentType: `application/json` **Request** 無 **Response** | Parameter | Type | Require | Description| | ----------- | -------- | -------- | -----------| | settings | object[] | Yes | 通知設定列表 | | isTypeEnabled | bool | Yes | 通知種類是否啟用 | > ***settings*** > | Parameter | Type | Require | Description| > | ----------- | -------- | -------- | -----------| > | id | long | Yes | 通知設定 ID | > | recipient | int | Yes | 通知者名稱 | > | address | long | Yes | 通知地址 | > | isEnabled | guid | Yes | 是否啟用 | --- ### 4.5.2. 取得 Telegram 新增用 Token、QRcode * URL: `/api/notification-setting/telegram-token ` * Method: `GET` * ContentType: `application/json` **Request** 無 **Response** | Parameter | Type | Require | Description| | ----------- | -------- | -------- | -----------| | token | string | Yes | token | | url | string | Yes | QRcode Url(打開Pokedom Bot連結,進入後點選start會自動綁定) | --- ### 4.5.3. 取得 Telegram 修改用 Token、QRcode * URL: `/api/notification-setting/telegram-token` * Method: `GET` * ContentType: `application/json` **Request** | Parameter | Type | Require | Description| | ----------- | -------- | -------- | -----------| | settingId | long | Yes | 通知設定ID | ```json= { "settingId": 123 } ``` **Response** | Parameter | Type | Require | Description| | ----------- | -------- | -------- | -----------| | token | string | Yes | token | | url | string | Yes | QR-Code(打開Pokedom Bot連結,進入後點選start會自動綁定) | --- ### 4.5.4. 刪除 Telegram 通知人員 * URL: `/api/notification-setting/telegram` * Method: `DELETE` * ContentType: `application/json` **Request** | Parameter | Type | Require | Description| | ----------- | -------- | -------- | -----------| | id | long | Yes | 通知設定ID | ```json= { "id": 123 } ``` **Response** 無 --- ## 4.6. 通知發送測試 * URL: `/api/notification-setting/test-send` * Method: `POST` * ContentType: `application/json` **Request** | Parameter | Type | Require | Description| | ----------- | -------- | -------- | -----------| | id | long | Yes | 通知設定ID | | message | string | Yes | 測試訊息 | ```json= { "id": 123, "message": "測試訊息" } ``` **Response** 無 --- ## 4.7. 啟用/停用 ### 4.7.1. 通知發送種類 啟用/停用 * URL: `/api/notification-setting/type-enabled` * Method: `PUT` * ContentType: `application/json` **Request** | Parameter | Type | Require | Description| | ----------- | -------- | -------- | -----------| | type | string | Yes | 通知種類 ( 固定值: email, sms, telegram, teams) | | isEnabled | bool | Yes | true 啟用,false 停用 | ```json= { "type": "email", "isEnabled": true } ``` **Response** 無 --- ### 4.7.2. 通知人員 啟用/停用 * URL: `/api/notification-setting/enabled` * Method: `PUT` * ContentType: `application/json` **Request** | Parameter | Type | Require | Description| | ----------- | -------- | -------- | -----------| | id | long | Yes | 通知設定ID | | isEnabled | bool | Yes | true 啟用,false 停用 | ```json= { "id": 465, "isEnabled": true } ``` **Response** 無 --- # 5. 即時批量測試 API ## 5.1. 測試查詢 * URL: `/api/batch-test` * Method: `GET` * ContentType: `application/json` **Request** | Parameter | Type | Require | Description| | ----------- | -------- | -------- | -----------| | uid | guid | Yes | 測試 ID | ```json= { "uid": "2b5cdeed-777c-43d8-8e69-e2a5a65eddb0" } ``` **Response** | Parameter | Type | Require | Description| | ----------- | -------- | -------- | -----------| | uid | guid | Yes | 測試 ID | | memo | string | Yes | 測試備註 | | setting | object | Yes | 測試設定 | | urls | object[] | Yes | Urls資料 | > ***setting*** > | Parameter | Type | Require | Description| > | ----------- | -------- | -------- | -----------| > | timeoutSecond | long | Yes | 網站檢查過期時間 ( 固定值 : 30、60、90、120、150、180、210、240、270、300 ) | > | useMobileUserAgent | bool | Yes | 是否使用手機檢測 | > | contentCheck | string | Yes | 檢測網站內容 | > | headerCheck | object[] | No | 檢測Header參數 ( 最多5組 ) | > > ***headerCheck*** > >| Parameter | Type | Require | Description| > >| ----------- | -------- | -------- | -----------| > >| name | string | No | Header Key 名字 | > >| value | string | No | Header value 參數 | > ***urls*** > | Parameter | Type | Require | Description| > | ----------- | -------- | -------- | -----------| > | urlid | int | Yes | 測試Url ID | > | url | string | Yes | url網址 | > | status | string | Yes | 測試狀態 ( 固定值 : up、warning、down、unknown ) | > | nodeInfo | object | Yes | 測試記錄節點統計 | > > ***nodeInfo*** > >| Parameter | Type | Require | Description| > >| ----------- | -------- | -------- | -----------| > >| totalNode | long | Yes | 測試節點數量 | > >| successNode | long | Yes | 測試正常節點數量 | > >| datas | object[] | Yes | 節點資料 | > > > ***datas*** > > >| Parameter | Type | Require | Description| > > >| ----------- | -------- | -------- | -----------| > > >| uid | guid | Yes | 測試 ID | > > >| urlid | int | Yes | 測試Url ID | > > >| testTime | long | Yes | 測試時間 ( UTC Unix時間戳,毫秒 ) | > > >| status | string | Yes | 測試狀態 ( 固定值 : up、warning、down、unknown ) | > > >| requestTime | long | Yes | 實際請求測試時間 ( UTC Unix時間戳,毫秒 ) | > > >| expireTime | long | Yes | 測試容許時間 ( UTC Unix時間戳,毫秒 ) | > > >| url | string | Yes | 測試網址 | > > >| urlIp | string | Yes | 解析測試網址得到的IP | > > >| urlIpProvince | string | Yes | 解析IP所在地 | > > >| region | string | Yes | 監測點 ( 省分 ) | > > >| city | string | Yes | 監測點 ( 城市 ) | > > >| isp | string | Yes | 監測點 ( 電信商 ) | > > >| httpStatus | int? | Yes | http狀態碼 ( -1:無法測試、-2:節點維護 ) | > > >| redirectUrl | string | Yes | 轉址的網址 | > > >| responseTime | long? | Yes | 測試完成時間 ( UTC Unix時間戳,毫秒 ) | > > >| totalTime | int? | Yes | 總耗時 ( ms ) | > > >| dnsResolveTime | int? | Yes | 解析域名花費的時間 ( ms ) | > > >| tcpTime | int? | Yes | TCPING連結時間 ( ms ) | > > >| downloadTime | int? | Yes | 下載花費的時間 ( ms ) | > > >| downloadSize | int? | Yes | 實際下載的檔案大小 ( byte ) | > > >| fileSize | int? | Yes | 檔案大小 ( byte ) | > > >| specialContentCheck | string | Yes | 特定內容驗證結果 ( 固定值: 無、異常、正常、無法測試 ) | > > >| resultHeader1 | string | Yes | 第1組Header檢查結果 ( 固定值: 無、異常、正常、找不到此Header ) | > > >| resultHeader2 | string | Yes | 第2組Header檢查結果 ( 固定值: 無、異常、正常、找不到此Header ) | > > >| resultHeader3 | string | Yes | 第3組Header檢查結果 ( 固定值: 無、異常、正常、找不到此Header ) | > > >| resultHeader4 | string | Yes | 第4組Header檢查結果 ( 固定值: 無、異常、正常、找不到此Header ) | > > >| resultHeader5 | string | Yes | 第5組Header檢查結果 ( 固定值: 無、異常、正常、找不到此Header ) | ```json= { "uid": "2b5cdeed-777c-43d8-8e69-e2a5a65eddb0", "memo": "備註", "setting":{ "timeoutSecond": 60, "useMobileUserAgent": true, "contentCheck": "", "headerCheck": [{"name": "test", "value": "test"}] }, "urls": [ { "urlid": 1, "url": "google.com", "status": "up", "nodeInfo": { "totalNode": 7, "successNode": 7 } "data": [ { "uid": "2b5cdeed-777c-43d8-8e69-e2a5a65eddb0", "urlid": 1, "testTime": 1590364800000, "status": "up", "requestTime": 1590364850000, "expireTime": 1590364900000, "url": "google.com", "urlIp": "14.215.177.39", "urlIpProvince": "江苏省南京市 电信", "region": "江西", "city": "南昌", "isp": "电信", "httpStatus": 200, "redirectUrl": "https://google.com/", "responseTime": 1590364890000, "totalTime": 257, "dnsResolveTime": 1, "tcpTime": 20, "downloadTime": 143, "downloadSize": 60930, "fileSize": 60930, "resultHeader1": "無", "resultHeader2": "無", "resultHeader3": "無", "resultHeader4": "無", "resultHeader5": "無" } ] } ] } ``` --- ## 5.2. 新增批量測試 * URL: `/api/batch-test` * Method: `POST` * ContentType: `application/json` **Request** | Parameter | Type | Require | Description| | ----------- | -------- | -------- | -----------| | memo | string | Yes | 測試備註 | | setting | object | Yes | 測試設定 | | urls | string[] | Yes | Urls網址 ( 最大400個 ) | > ***setting*** > | Parameter | Type | Require | Description| > | ----------- | -------- | -------- | -----------| > | timeoutSecond | long | Yes | 網站檢查過期時間 ( 固定值 : 30、60、90、120、150、180、210、240、270、300 ) | > | useMobileUserAgent | bool | Yes | 是否使用手機檢測 | > | contentCheck | string | Yes | 檢測網站內容 | > | headerCheck | object[] | No | 檢測Header參數 ( 最多5組 ) | > > ***headerCheck*** > >| Parameter | Type | Require | Description| > >| ----------- | -------- | -------- | -----------| > >| name | string | No | Header Key 名字 | > >| value | string | No | Header value 參數 | ```json= { "memo": "備註", "setting":{ "timeoutSecond": 60, "useMobileUserAgent": true, "contentCheck": "", "headerCheck": [{"name": "test", "value": "test"}] }, "urls": [ "google.com", "yahoo.com.tw" ] } ``` **Response** | Parameter | Type | Require | Description| | ----------- | -------- | -------- | -----------| | uid | guid | Yes | 測試 ID | ```json= { "uid": "2b5cdeed-777c-43d8-8e69-e2a5a65eddb0" } ``` --- # 6. 附錄 ## 6.1. 回傳狀態代碼 | Parameter | Description| | ----------- | -------- | | statusCode | 狀態碼 | | message | 詳細訊息 | >| statusCode | 描述 | >| --- | --- | >| 1000 | 操作成功 | >| 2000 | 參數錯誤 | >| 3000 | 操作錯誤 |