サブアカウントの一時停止

このコード・スニペットでは、Subaccountsを一時停止する方法を説明します。

以下の変数が、便利な方法で必要な値に設定されていることを確認してください:

キー 説明
VONAGE_API_KEY 親アカウントのAPIキー。
VONAGE_API_SECRET 親アカウントのAPIシークレット。
SUBACCOUNT_KEY 停止するSubaccountのAPIキー。

Write the code

Add the following to suspend-subaccount.sh:

curl -X "PATCH" "https://api.nexmo.com/accounts/$VONAGE_API_KEY/subaccounts/$SUBACCOUNT_KEY" -u $VONAGE_API_KEY:$VONAGE_API_SECRET \
     -H "Content-Type: application/json"  \
     -d $'{"suspended":true}'

View full source

Run your code

Save this file to your machine and run it:

bash suspend-subaccount.sh

試してみる

コードを実行すると、親アカウントの指定されたSubaccountsが一時停止されます。