秘密を作る
新しい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'"}'Run your code
Save this file to your machine and run it:
Prerequisites
npm install @vonage/server-sdkCreate a file named create-api-secret.js and add the following code:
Run your code
Save this file to your machine and run it:
Prerequisites
Add the following to build.gradle:
Create a class named CreateSecret and add the following code to the main method:
Run your code
We can use the アプリケーション plugin for Gradle to simplify the running of our application. Update your build.gradle with the following:
Run the following gradle command to execute your application, replacing com.vonage.quickstart.kt.account with the package containing CreateSecret:
Prerequisites
Add the following to build.gradle:
Create a class named CreateSecret and add the following code to the main method:
Run your code
We can use the アプリケーション plugin for Gradle to simplify the running of our application. Update your build.gradle with the following:
Run the following gradle command to execute your application, replacing com.vonage.quickstart.account with the package containing CreateSecret:
Prerequisites
Install-Package VonageCreate a file named CreateSecret.cs and add the following code:
Add the following to CreateSecret.cs:
Prerequisites
composer require vonage/clientCreate a file named create-a-secret.php and add the following code:
Run your code
Save this file to your machine and run it:
Prerequisites
pip install vonage python-dotenvRun your code
Save this file to your machine and run it:
Prerequisites
gem install vonageCreate a file named create-a-secret.rb and add the following code:
Run your code
Save this file to your machine and run it: