List Applications

In this code snippet you will see how to list all v1 and v2 Applications.

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.

Write the code

Add the following to list-applications.sh:

Copy to Clipboard
curl -X "GET" "https://api.nexmo.com/v2/applications" \
     -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:

./list-applications.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.get({}, (error, result) => {
  if(error) {
    console.error(error);
  }
  else {
    console.log(result);
  }
}, true);

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 list-applications.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 list-applications.py:

Copy to Clipboard
response = client.application_v2.list_applications()

pprint(response)

View full source

Run your code

Save this file to your machine and run it:

python3 list-applications.py