curl
サンプルコード(curl)の使い方Copied!
サンプルコード(curl)の実行環境はMacOSやLinux、Windows10以降などBashを利用できる環境を想定しています。
Windows環境でcurlコマンドが利用できない場合はGit Bashなどの導入をご検討ください。
事前検討版のエンドポイントはダミーです。リクエストを送信してもご利用いただけません。
サンプルコード(curl)一覧Copied!
SMS送信/IVR認証API(SMS送信のみ)Copied!
curl https://www.media-sms-ope.example.com/Endpoint1/ \
--request POST \
--header 'Content-Type: multipart/form-data' \
--form username=$username \
--form password=$password \
--form mobilenumber=$mobilenumber \
--form method=1 \
--form smstext=$smstext_1 \
--form smsid=$smsid1
SMS送信/IVR認証API(IVR認証のみ)Copied!
※APIリクエスト成功後、mobilenumber宛に着た着信を受電すると認証成功と判定されます。受電した際に
curl https://www.media-sms-ope.example.com/Endpoint1/ \
--request POST \
--header 'Content-Type: multipart/form-data' \
--form username=$username \
--form password=$password \
--form mobilenumber=$mobilenumber \
--form method=7 \
--form holdingtime=3 \
--form repeatcall=3 \
--form 1stcall=3 \
--form intervalcall=3 \
--form ringingtime=5 \
--form ipphone=$ipphone_ivr \
--form authcode=1234 \
--form authtime=3 \
--form waitauth=3 \
--form smsid=$smsid2
送達結果/IVR 認証結果取得API(個別方式)Copied!
※予め送達結果確認用にSMSを送信しておく必要があります。
;: # 送達結果確認用にSMSを送信する
curl https://www.media-sms-ope.example.com/Endpoint1/ \
--request POST \
--header 'Content-Type: multipart/form-data' \
--form username=$username \
--form password=$password \
--form mobilenumber=$mobilenumber \
--form method=1 \
--form smstext=$smstext_2 \
--form smsid=$smsid3
SMSを送信できたら送達結果取得APIを用いて状態が送信済であることを確認します。
;: # 送達結果取得 API(SMS 送達結果取得個別方式)
curl --request POST \
--url https://www.media-sms-ope.example.com/Endpoint2/ \
--header 'Content-Type: multipart/form-data' \
--form username=$username \
--form password=$password \
--form smsid=$smsid3