SORACOM CLI を実行するときに --help フラグまたは -h フラグを指定すると、ヘルプを確認できます。
ここでは、soracom sims list コマンドの使いかたを調べる操作を紹介します。
soracom --helpを実行します。soracom [command]のヘルプが表示されます。Available Commands:とFlags:は、soracom [command]の[command]に指定できる文字列と、その説明です。$ soracom --help A command line tool to invoke SORACOM API Usage: soracom [command] Available Commands: : sims Manage SIMs. : Flags: --api-key string Specify API key otherwise soracom-cli performs authentication on behalf of you : Use "soracom [command] --help" for more information about a command.この表示から、
[command]にsimsや--api-keyが指定できることがわかります。soracom sims --helpを実行します。soracom sims [command]のヘルプが表示されます。Available Commands:、Flags:、およびGlobal Flags:は、soracom sims [command]の[command]に指定できる文字列と、その説明です。$ soracom sims --help Manage SIMs. Usage: soracom sims [command] Available Commands: : list List SIMs. : Flags: -h, --help help for sims Global Flags: --api-key string Specify API key otherwise soracom-cli performs authentication on behalf of you : Use "soracom sims [command] --help" for more information about a command.この表示から、
[command]にlistや--api-keyが指定できることがわかります。soracom sims list --helpを実行します。soracom sims list [flags]のヘルプが表示されます。Flags:およびGlobal Flags:は、soracom sims list [flags]の[flags]に指定できる文字列と、その説明です。$ soracom sims list --help Returns a list of SIMs that match certain criteria. If the total number of SIMs does not fit in one page, a URL for accessing the next page is returned in the 'Link' header of the response. Usage: soracom sims list [flags] Flags: --fetch-all Do pagination automatically. -h, --help help for list : Global Flags: --api-key string Specify API key otherwise soracom-cli performs authentication on behalf of you :この表示から、
[flag]に--fetch-allや--api-keyなどが指定できることがわかります。
Windows で SORACOM CLI を利用する場合の注意
リクエストボディに JSON を指定するときは、JSON の「"」をエスケープしてください。
macOS または Linux でコマンドを実行する例と、Windows のコマンドプロンプトおよび PowerShell で実行する例を紹介します。
macOS または Linux の例:
JSON 全体を「'」で囲みます。
soracom auth verify-password-reset-token --body '{"password": "string", "token": "string"}'Windows のコマンドプロンプトの例:
JSON 全体を「"」で囲み、さらに JSON の「"」を「"""」に置き換えてください。具体的には、以下のように実行します。
soracom auth verify-password-reset-token --body "{"""password""": """string""", """token""": """string"""}"Windows の PowerShell の例:
JSON 全体を「"」で囲み、さらに JSON の「"」を「\`"」に置き換えてください。具体的には、以下のように実行します。
soracom auth verify-password-reset-token --body "{\`"password\`": \`"string\`", \`"token\`": \`"string\`"}"