秘密を作る

新しいAPIシークレットを作成するには POST リクエストを秘密管理APIに送る。

新しいAPIシークレットは、以下のルールを満たさなければならない:

  • 最低8文字
  • 最大25文字
  • 小文字1文字以上
  • 大文字1文字以上
  • 最小1桁
キー説明
VONAGE_API_KEY

Your Vonage API key (see it on your dashboard).

VONAGE_API_SECRET

Your Vonage API secret (also available on your dashboard).

NEW_SECRET

The new API secret for the API key.

Write the code

Add the following to create-secret.sh:

curl -X POST "https://api.nexmo.com/accounts/$ACCOUNT_ID/secrets" \
     -H 'Content-Type: application/json' \
     -u "$VONAGE_API_KEY:$VONAGE_API_SECRET" \
     -d '{"secret":"'$ACCOUNT_SECRET_VALUE'"}'

View full source

Run your code

Save this file to your machine and run it:

bash create-secret.sh