Cancel report
This code snippet shows you how to cancel the creation of a report.
Example
| Key | Description |
|---|---|
VONAGE_API_KEY | Your Vonage API key (see it on your dashboard). |
VONAGE_API_SECRET | Your Vonage API secret (also available on your dashboard). |
REQUEST_ID | The request ID returned when a report was created |
Write the code
Add the following to cancel-report.sh:
curl -X DELETE -u "$VONAGE_API_KEY:$VONAGE_API_SECRET" \
"https://api.nexmo.com/v2/reports/$REQUEST_ID"Run your code
Save this file to your machine and run it:
bash cancel-report.sh
Prerequisites
Install-Package VonageCreate a file named CancelReport.cs and add the following code:
var credentials = Credentials.FromApiKeyAndSecret(VONAGE_API_KEY, VONAGE_API_SECRET);
Client = new VonageClient(credentials);Write the code
Add the following to CancelReport.cs:
var request = CancelReportRequest.Build()
.WithReportId(requestId)
.Create();
var response = await Client.ReportsClient.CancelReportAsync(request);Try it out
Set the replaceable variables. Parameter validity may vary with product.
Run the script to cancel the report.