レポート一覧
この操作は非推奨です。この操作には "日付範囲でレコードを同期取得" スニペットで REPORTS-USAGE 製品を使用することができます。また "レポートを非同期に作成する" スニペット REPORTS-USAGE をペイロードに含める。
このコード・スニペットでは、指定されたステータスを持つすべての非同期レポート・リクエストをリストする方法を示します。必要に応じて、日付範囲を指定することもできます。
なお、データの保存期間は4日間であるため、4日以上前のレポートはリストに掲載されない。
例
| キー | 説明 |
|---|---|
VONAGE_API_KEY | Your Vonage API key (see it on your dashboard). |
VONAGE_API_SECRET | Your Vonage API secret (also available on your dashboard). |
ACCOUNT_ID | The account ID (same as |
REPORT_STATUS | Status of report generation, can be any of |
日付範囲を指定しない場合は、過去7日間に作成されたレポートを受け取ります。
Write the code
Add the following to list-reports.sh:
curl -u "$VONAGE_API_KEY:$VONAGE_API_SECRET" \
"https://api.nexmo.com/v2/reports?account_id=$ACCOUNT_ID&status=$REPORT_STATUS"Run your code
Save this file to your machine and run it:
試してみる
{
"self_link": "https://api.nexmo.com/v2/reports?account_id=abcd1234&status=SUCCESS",
"items_count": 17,
"reports": [
{
"request_id": "ri3p58f-48598ea7-1234-5678-90ab-faabd79abcde",
"request_status": "SUCCESS",
"direction": "outbound",
"product": "SMS",
"account_id": "abcd1234",
"date_start": "2020-05-21T13:27:00+0000",
"date_end": "2020-05-21T13:57:00+0000",
"include_subaccounts": false,
"status": "delivered",
"include_message": false,
"receive_time": "2020-06-03T15:24:31+0000",
"start_time": "2020-06-03T15:24:32+0000",
"_links": {
"self": {
"href": "https://api.nexmo.com/v2/reports/ri3p58f-48598ea7-1234-5678-90ab-faabd79abcde"
},
"download_report": {
"href": "https://api.nexmo.com/v3/media/e87a2d7c-abcd-1234-aa45-9bf17a1eb2a1"
}
},
"items_count": 4
},
...
]
}
レポートに注目 request_id がレスポンスの中にある。また file_idこの場合 e87a2d7c-abcd-1234-aa45-9bf17a1eb2a1.