我试图在我的rails应用程序上创建一个用户从os x终端curl命令。无论我如何格式化数据,应用程序都会返回一个没有通过验证的响应。
curl http://localhost:3000/api/1/users.json -i -X POST -d {"user":{"first_name":"firstname","last_name":"lastname","email":"email@email.com","password":"app123","password_confirmation":"app123"}}"
我已经尝试了所有的变化。我试过使用[]括号,我试过user={data..似乎什么都不管用。什么好主意吗?
首先,在命令的末尾有一个无关的"。
试试这个
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