Audit APIの技術的詳細

Vonage Audit APIを使用すると、イベントを追跡してアカウントを監視することができます。これらのイベントは、アカウント・ユーザがSDKを使用したり、Vonage API Dashboardとやり取りする際に生成されます。

このAPIを使えば、次のことができる:

  • Audit イベントのリストを取得します。
  • 特定の Audit イベントを取得します。
  • 日付、ユーザーID、イベントタイプなどのパラメータでイベントをフィルタリングします。

ベータ

このAPIは現在ベータ版です。

Vonageは常にお客様のフィードバックをお待ちしております。お客様のご意見は製品の改善に役立ちます。サポートが必要な場合は、Eメール サポート 件名に Audit API とご記入ください。ベータ期間中のサポートは月曜日から金曜日までとさせていただきます。

ベータ期間中、Vonage は Audit API の機能を拡張する可能性があります。

内容

この文書では、以下について学ぶことができる:

認証

Audit APIとのやり取りは、Basic認証を使用して認証されます。ベーシック認証では VONAGE_API_KEY そして VONAGE_API_SECRET を使用してAPIリクエストを検証します。認証に関する一般的な情報は 認証.

監査イベント

Audit イベントは、ユーザが Vonage API または Vonage API Dashboard とやり取りする際に発生するアクティビティです。Audit イベントは JSON オブジェクトで表されます。監査イベントの例には以下が含まれます:

  • アカウント設定の更新。
  • Vonage Numbersはアプリケーションに割り当てられます。
  • Vonageアプリケーションの作成。

Auditイベントの種類に関する詳細な情報は、「Auditイベントの種類」を参照されたい。 監査イベント ページを参照されたい。

Audit イベントオブジェクト

監査イベント・オブジェクトの例としては、「数字の更新」がある。 event_typeNUMBER_UPDATED:

{
  "_links": {
    "self": {
      "href": "http://api.nexmo.com/beta/audit/events/aaaaaaaa-bbbb-cccc-dddd-0123456789ab"
    }
  },
  "id": "aaaaaaaa-bbbb-cccc-dddd-0123456789ab",
  "event_type": "NUMBER_UPDATED",
  "event_type_description": "Number updated",
  "created_at": "2018-08-13T10:15:31",
  "account_id": "abcd1234",
  "source": "DEVAPI",
  "source_ip": "154.59.142.233",
  "source_description": "Developer API",
  "source_country": "GB",
  "context": {
    "country": "GB",
    "msisdn": "447700900000",
    "voice-type": "sip",
    "voice-value": "sip:user@example12.com",
    "accountId": "abcd1234"
  }
}

はじめに

この例では、Audit API を使い始める方法を示します。監査イベントのリストを取得する方法を示します。

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

キー 説明
VONAGE_API_KEY Vonage APIキー。
VONAGE_API_SECRET あなたのVonage APIシークレット。

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

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 Audit Events" http://demo.ngrok.io/webhooks/answer http://demo.ngrok.io/webhooks/events --keyfile private.key

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

source "../config.sh"

View full source

Write the code

Add the following to get-events.sh:

curl "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-events.sh

Concepts

  • 監査イベント: 監査イベントの概念(監査イベントの種類と構造を含む)。

コード・スニペット

使用例

また、次のようなブログ記事もある。 Pythonを使ったAudit APIでアプリケーションを監視する 役に立つかもしれない。

参考