Assign an emergency number

This code snippet assigns an emergency number.

Example

Replace the following variables in the example code:

KeyDescription
EMERGENCY_NUMBER

The emergency number.

EMERGENCY_ADDRESS_ID

The Vonage address unique ID.

EMERGENCY_CONTACT_NAME

The person of contact in case of emergency.

Write the code

Add the following to assign-number.sh:

curl -X "PATCH" "https://api.nexmo.com/v1/emergency/numbers/$EMERGENCY_NUMBER" \
     -H 'Content-Type: application/json' \
     -u "$VONAGE_API_KEY:$VONAGE_API_SECRET" \
     -d $'{
        {
           "address": {
              "id": "'$EMERGENCY_ADDRESS_ID'"
           },
           "contact_name": "'$EMERGENCY_CONTACT_NAME'"
        }
     }'

View full source

Run your code

Save this file to your machine and run it:

bash assign-number.sh