curl json 通过终端向 rails 应用程序发送请求

我正在尝试使用来自 os x 终端的 curl 命令在我的 rails 应用程序上创建一个用户.无论我如何格式化数据,应用都会返回一个响应,表明我的验证都没有通过.

I'm trying to create a user on my rails app with a curl command from os x terminal. No matter how I format the data, the app returns a responses that non of my validations have passed.

curl http://localhost:3000/api/1/users.json -i -X POST -d {"user":{"first_name":"firstname","last_name":"lastname","email":"","password":"app123","password_confirmation":"app123"}}"

我尝试了所有变体.我试过使用 [] 括号,我试过 user={data..} ,但似乎没有任何效果.有什么想法吗?

I've tried every variation. I've tried using [] brackets, I've tried user={data..} and nothing seems to work. Any ideas?

 1 条回答