LoginSignup
1
1

More than 5 years have passed since last update.

curlコマンド ~ アラート通知などで自動メール送信機能を実装した際に、テストでリクエストを投げる方法(コマンドメモ)

Last updated at Posted at 2017-07-08

アラートメールを送信する機能を実装し、動作確認する際に
jsonデータを送り擬似的にアラートを発生させます。

ターミナル(コマンドプロンプト)から下記を叩きます。

$ curl -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d 'jsonデータ' 送信先URL

ショップ(shop)のレジ(account)に異常が発生した際の自動送信メール機能を実装
・アラート(alert)のID(alert_id)が14の場合
・shop-controllerのalertDataメソッドを呼ぶ

下記のようにcurlコマンドを叩きます。

$ curl -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"shop_id":"1","account_id":"1","alert_data":{"alert_id":"14","additional_info":"hoge"}}' http://localhost:3000/shop-controller/alertData/

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1