Delete an Application

In this code snippet you will see how to delete the specified Application.

Example

You will need to ensure that the following replaceable values are set in the example code using any convenient method:

Key Description
NEXMO_API_KEY Your Nexmo API key.
NEXMO_API_SECRET Your Nexmo API secret.
NEXMO_APPLICATION_ID The application ID for the Nexmo application you want to delete.

Write the code

Add the following to delete-application.sh:

Copy to Clipboard
curl -X "DELETE" "https://api.nexmo.com/v2/applications/$NEXMO_APPLICATION_ID" \
     -H 'Content-Type: application/json' \
     -u "$NEXMO_API_KEY:$NEXMO_API_SECRET"

View full source

Run your code

Save this file to your machine and run it:

./delete-application.sh

Prerequisites

Install dependencies

npm install nexmo@beta
Initialize your dependencies

Create a file named app.js and add the following code:

Copy to Clipboard
const Nexmo = require('nexmo')
   
var nexmo = new Nexmo({
    apiKey: NEXMO_API_KEY,
    apiSecret: NEXMO_API_SECRET
}, {
    debug: true
});

View full source

Write the code

Add the following to app.js:

Copy to Clipboard
nexmo.applications.delete(NEXMO_APPLICATION_ID, (error, result) => {
  if(error) {
    console.error(error);
  }
  else {
    console.log(result);
  }
});

View full source

Run your code

Save this file to your machine and run it:

node app.js

Prerequisites

Install dependencies

pip install nexmo
Initialize your dependencies

Create a file named delete-application.py and add the following code:

Copy to Clipboard
client = nexmo.Client(
    key=NEXMO_API_KEY,
    secret=NEXMO_API_SECRET
)

View full source

Write the code

Add the following to delete-application.py:

Copy to Clipboard
response = client.application_v2.delete_application(NEXMO_APPLICATION_ID)

pprint(response)

View full source

Run your code

Save this file to your machine and run it:

python3 delete-application.py