監査イベントの種類を取得する

このコード・スニペットでは、サポートされているすべてのイベント・タイプのリストを取得する方法を説明します。

以下の置換可能な値が、便利な方法でサンプルコードに設定されていることを確認する必要があります:

キー説明
VONAGE_API_KEY

Your Vonage API key (see it on your dashboard).

VONAGE_API_SECRET

Your Vonage API secret (also available on your dashboard).

次の例では アプリケーションの作成 そして 依存関係を初期化する 手続きは任意である。

Prerequisites

A Vonage application contains the required configuration for your project. You can create an application using the Vonage CLI (see below) or via the dashboard. To learn more about applications see our Vonage concepts guide.

Install the CLI

npm install -g nexmo-cli

Create an application

Once you have the CLI installed you can use it to create a Vonage application. Run the following command and make a note of the application ID that it returns. This is the value to use in NEXMO_APPLICATION_ID in the example below. It will also create private.key in the current directory which you will need in the Initialize your dependencies step

Vonage needs to connect to your local machine to access your answer_url. We recommend using ngrok to do this. Make sure to change demo.ngrok.io in the examples below to your own ngrok URL.

nexmo app:create "Get Event Types" http://demo.ngrok.io/webhooks/answer http://demo.ngrok.io/webhooks/events --keyfile private.key

Create a file named get-event-types.sh and add the following code:

source "../config.sh"

View full source

Write the code

Add the following to get-event-types.sh:

curl -X "OPTIONS" "https://api.nexmo.com/beta/audit/events" \
     -u "$VONAGE_API_KEY:$VONAGE_API_SECRET"

View full source

Run your code

Save this file to your machine and run it:

./get-event-types.sh

試してみる

シェルでコマンドを実行する。この呼び出しは、以下のように、サポートされている監査イベント・タイプのリストを取得する:

{
  "eventTypes": [
    {
      "type": "USER_STATUS",
      "description": "User status updated"
    },
    {
      "type": "USER_UPDATE",
      "description": "User updated"
    },
    {
      "type": "USER_BILLING_UPDATE",
      "description": "User billing updated"
    },
    {
      "type": "USER_CREATE",
      "description": "User created"
    },
    {
      "type": "USER_LOGIN",
      "description": "User login into Customer dashboard"
    },
    {
      "type": "USER_LOGOUT",
      "description": "User logout from Customer dashboard"
    },
    {
      "type": "USER_PRODUCT_SEARCH",
      "description": "User product search"
    },
    {
      "type": "USER_API_KEYS_UPDATE",
      "description": "Sub-accounts for user updated"
    },
    {
      "type": "ACCOUNT_SECRET_DELETE",
      "description": "Account secret deleted"
    },
    {
      "type": "ACCOUNT_SECRET_CREATE",
      "description": "Account secret created"
    },
    {
      "type": "ACCOUNT_UPDATE_SETTINGS_API",
      "description": "Account Settings updated via API"
    },
    {
      "type": "NUMBER_ASSIGN",
      "description": "Number assigned"
    },
    {
      "type": "NUMBER_UPDATED",
      "description": "Number updated"
    },
    {
      "type": "NUMBER_USER_CANCELED",
      "description": "Number canceled by user"
    },
    {
      "type": "NUMBER_LINKED",
      "description": "Number linked to application"
    },
    {
      "type": "NUMBER_UNLINKED",
      "description": "Number unlinked from application"
    },
    {
      "type": "APP_CREATE",
      "description": "Application created"
    },
    {
      "type": "APP_UPDATE",
      "description": "Application updated"
    },
    {
      "type": "APP_DELETE",
      "description": "Application deleted"
    },
    {
      "type": "APP_DISABLE",
      "description": "Application disabled"
    },
    {
      "type": "APP_ENABLE",
      "description": "Application enabled"
    },
    {
      "type": "IP_WHITELIST_CREATE",
      "description": "Whitelist IP added"
    },
    {
      "type": "IP_WHITELIST_DELETE",
      "description": "Whitelist IP deleted"
    },
    {
      "type": "AUTORELOAD_ENABLE",
      "description": "Automatic reload enabled"
    },
    {
      "type": "AUTORELOAD_UPDATE",
      "description": "Automatic reload settings updated"
    },
    {
      "type": "AUTORELOAD_DISABLE",
      "description": "Automatic reload disabled"
    }
  ]
}