json RESTテスト

Contributed by: akira on 2014年 9月1日(月) 09:47 JST

Last modified on

jsonを使った、webAPIのテスト方法について
コマンドラインcurl 編 curl -X POST -H "Content-Type: application/json" http://localhost:3000/comments[*1] -d @comment.json
iオプションでレスポンスをconsoleに出せる。
curl -s -i -X POST -d 'a=hoge' -d 'b=fuga' "http://localhost:5000/[*2] "

% curl -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"user":{"first_name":"firstname","last_name":"lastname","email":"email@email.com","password":"app123","password_confirmation":"app123"}}' http://localhost:3000/api/1/users[*3]

コメント (0件)

Geeklog Site - json RESTテスト
https://geeklog.craine.ne.jp/article.php?story=20141010094751306

[*1] http://localhost:3000/comments
[*2] http://localhost:5000/
[*3] http://localhost:3000/api/1/users