申請 Google Safe Browsing API 的 API 金鑰 (API-key) 主要是透過 Google Cloud Platform (GCP) 的控制台 (Console) 來完成。
以下是一般步驟的整理:
申請 Google Safe Browsing API 金鑰的步驟
- 登入 Google Developers Console/Google Cloud Platform (GCP) 控制台
- 前往 Google Cloud Platform 的憑證頁面:
https://console.developers.google.com/apis/credentials
- 請先登入您的 Google 帳號。
- 建立或選擇一個專案
- 如果您還沒有專案,請按**「建立專案」**並輸入一個名稱(例如:
Safe Browsing Project)。
- 如果您已有專案,請在頁面頂端選擇該專案。
- 啟用 Safe Browsing API 服務
- 在左側導覽列中,選擇 「API 與服務」 > 「資料庫」 (Library)。
- 在搜尋欄位中輸入
Safe Browsing。
- 點選搜尋結果中的 「Safe Browsing API」。
- 點選**「啟用」** (Enable)。
- 建立 API 金鑰 (API Key)
- 啟用 API 後,請回到 「API 與服務」 > 「憑證」 (Credentials) 頁面。
- 點選頂部的 「建立憑證」 (Create credentials),然後選擇 「API 金鑰」 (API key)。
- 系統會立即產生一個新的 API 金鑰,並顯示在一個彈出視窗中。請複製並妥善保管這個金鑰。
- (可選但強烈建議)限制 API 金鑰
- 為了安全起見,請點選新建立的 API 金鑰名稱或點選**「編輯 API 金鑰」**來設定限制。
- 應用程式限制 (Application restrictions): 如果您知道 API 將在哪個網域、IP 地址或應用程式上使用,建議在此處設定限制,防止金鑰被盜用。
- API 限制 (API restrictions): 選擇 「限制金鑰」,然後在下拉選單中選擇 「Safe Browsing API」,確保此金鑰只能用於此服務。
完成以上步驟後,您就可以在您的應用程式中使用這個 API 金鑰來呼叫 Google Safe Browsing API 了。
請注意:
- Google Safe Browsing API 預設僅供非商業用途。如果您需要用於商業或營利目的,請改為參考 Web Risk API。
- 務必對您的 API 金鑰進行限制,以防止未經授權的使用和產生不必要的費用。