这份文档还在翻译中,预期年底前完成。欢迎您提供宝贵的意见及建议。
Audit API Overview
The Vonage Audit API enables you to monitor your account by tracking events. These events are generated when your account users work with the SDKs or interact with the Vonage API Dashboard.
With this API you can:
- Retrieve a list of Audit events.
- Retrieve a specific Audit event.
- Filter events by parameters such as date, user ID, and event type.
Beta
This API is currently in Beta.
Vonage always welcomes your feedback. Your suggestions help us improve the product. If you do need help, please email support@nexmo.com and include Audit API in the subject line. Please note that during the Beta period support times are limited to Monday to Friday.
During the Beta period Vonage may expand the capabilities of the Audit API.
Contents
In this document you can learn about:
- Authentication
- Audit Events
- Audit Event Object
- How to Get Started with the Audit API
- Concepts
- Code Snippets
- Use Cases
- Reference
Authentication
Interactions with the Audit API are authenticated using Basic Authentication. Basic Authentication allows you to use your VONAGE_API_KEY
and VONAGE_API_SECRET
to validate your API requests. For more general information on authentication see Authentication.
Audit Events
Audit Events are activities that occur when a user interacts with the Vonage API or the Vonage API Dashboard. Audit events are represented by a JSON object. Examples of audit events include:
- Account settings updates.
- A Vonage Number gets assigned to an application.
- Creation of a Vonage application.
Further information on types of audit events is given on the Audit Events page.
Audit Event object
An example audit event object is 'updating a number' which has event_type
of NUMBER_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"
}
}
Getting Started
This example shows you how to get started with the Audit API. It demonstrates how to retrieve a list of audit events.
You will need to ensure that the following replaceable values are set in the example code using any convenient method:
Key | Description |
---|---|
VONAGE_API_KEY |
Your Vonage API key. |
VONAGE_API_SECRET |
Your Vonage API secret. |
In the following example the Create an application and Initialize your dependencies procedures are optional.
Prerequisites
A Vonage application contains the required configuration for your project. You can create an application using the Nexmo 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"
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"
Run your code
Save this file to your machine and run it:
./get-events.sh
Concepts
- Audit Events: Audit events concepts, including types and structure of audit events.
Code Snippets
Use Cases
There is also a blog post on how to monitor your applications with the Audit API with Python you might find useful.