--- title: "結果通知設定" slug: "filesafer-programming-noti" tags: ["api", "File Safer"] updated: 2026-09-17T09:28:45Z published: 2026-09-17T09:28:45Z canonical: "guide.ncloud-docs.com/filesafer-programming-noti" stale: true --- > ## Documentation Index > Fetch the complete documentation index at: https://guide.ncloud-docs.com/llms.txt > Use this file to discover all available pages before exploring further. # 結果通知設定 Classic/VPC環境で利用できます。 Hash Filterと File Filterが REST APIを使用し、検査結果通知の設定コード作成する方法を説明します。 参考 File Filter開発の先に、File Saferご利用の申し込み、API Gatewayご利用の申し込みと API Keyを作成する必要があります。詳細は、[File Safer を開始する](/docs/ja/filesafer-start)をご参照ください。 ## 検査結果通知設定のシナリオ setNotiConfig APIを使用して検査結果通知を設定するシナリオは、次の通りです。 [1.認証値作成](/docs/ja/filesafer-programming-noti#1%EC%9D%B8%EC%A6%9D%EA%B0%92%EC%83%9D%EC%84%B1) [2.リクエスト Body作成](/docs/ja/filesafer-programming-noti#2%EC%9A%94%EC%B2%ADBody%EC%83%9D%EC%84%B1) [3.APIリクエスト](/docs/ja/filesafer-programming-noti#3API%EC%9A%94%EC%B2%AD) 参考 - setNotiConfig APIの明細は [setNotiConfig (Hash Filter/File Filter)](https://api.ncloud-docs.com/docs/ja/security-filesafer-setnoticonfig)をご参照ください。 - 現在設定された値を確認するには、[getNotiConfig (Hash Filter/File Filter)](https://api.ncloud-docs.com/docs/ja/security-filesafer-getnoticonfig)をご参照ください。 ## 検査結果通知設定のコード作成 シナリオに従ってコードを作成します。Hash Filterの setNotiConfigと File Filterの setNotiConfigは、リクエスト URIのみ異なります。認証値とパラメータ設定は同じです。 ### 1.認証値作成 NAVERクラウドプラットフォーム API使用認証に必要な IAM認証値を作成します。認証に必要なヘッダは次の通りです。 - `x-ncp-iam-access-key`: コンソールの **My Account** > **アカウントとセキュリティ管理** > **セキュリティ管理** > **アクセス管理**メニューから Access Keyを発行 - `x-ncp-apigw-signature-v2`: Access Keyとマッピングされる Secret Keyを HmacSHA256暗号化し、signature値を作成(改行文字は \nを使用) - `x-ncp-apigw-api-key`: API Gatewayで API Keyを発行 - `x-ncp-apigw-timestamp`: 認証値ではないがリクエストヘッダに含まれる。API明細を参照 参考 signature値を作成する方法とサンプルコードは、[NAVERクラウドプラットフォーム APIガイド > API の概要 > 基本 API > Ncloud API > 2.ヘッダ作成](https://api.ncloud-docs.com/docs/ja/common-ncpapi)をご参照ください。 ### 2.リクエスト Body作成 setNotiConfig APIの Bodyに結果通知設定値として notificationTypeを設定します。 notificationTypeの設定値は次の通りです。 | notificationType | 説明 | | --- | --- | | OFF | 通知しない | | MAL | マルウェア検知(照会)時に通知 | | MAE | マルウェア検知時、または照会失敗時に通知 | | ERR | 照会失敗時に通知 | | ALL | すべて通知 | ### 3.APIリクエスト Hash Filter setNotiConfig URIまたは File Filter setNotiConfig URIにリクエストを送信します。 - Hash Filter setNotiConfig URI: https://filesafer.apigw.ntruss.com/hashfilter/v1/setNotiConfig - File Filter setNotiConfig URI: https://filesafer.apigw.ntruss.com/filefilter/v1/setNotiConfig 以下は、Hash Filter setNotiConfig APIリクエストのサンプルコードです。 ``` public void setNotiConfig() throws Exception { String ACCESSKEY = "AAAAAAAAAAAAAAAAAAAA"; // access key (from portal or sub account) String apikey = API_GATEWAY_KEY; long timestamp = System.currentTimeMillis(); String method = "POST"; String apiURL = "/hashfilter/v1/setNotiConfig"; String signature = makeSignature(method, apiURL, timestamp); URL url = new URL(apiDomain + apiURL); HttpURLConnection con = (HttpURLConnection)url.openConnection(); con.setDoOutput(true); con.setRequestMethod(method); con.setRequestProperty("x-ncp-apigw-timestamp", Long.toString(timestamp)); con.setRequestProperty("x-ncp-iam-access-key", ACCESSKEY); con.setRequestProperty("x-ncp-apigw-signature-v2", signature); con.setRequestProperty("x-ncp-apigw-api-key", apikey); con.setRequestProperty("Content-Type", "application/json"); con.setRequestProperty("accept", "application/json"); // write request body DataOutputStream dos = new DataOutputStream(con.getOutputStream()); dos.writeBytes("{\r\n"); dos.writeBytes(" \"notificationType\": \"ALL\"\r\n"); dos.writeBytes("}"); // read http response code int responseCode = con.getResponseCode(); BufferedReader br = null; if(responseCode == 200) { br = new BufferedReader(new InputStreamReader(con.getInputStream())); } else { br = new BufferedReader(new InputStreamReader(con.getErrorStream())); } // read http response body String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = br.readLine()) != null) { response.append(inputLine); } } ``` 参考 分析結果通知を受けるため、高度な設定機能も使用できます。高度な設定は一定時間しきい値に該当するマルウェアが検知されると、通知する機能です。当該 APIに関する詳細な説明は、[setThresholdNotiConfig(Hash Filter/File Filter)](https://api.ncloud-docs.com/docs/ja/security-filesafer-setthresholdnoticonfig)をご確認ください。