通过终端将curl json post请求发送到rails应用程序
我正在尝试使用 os x 终端的curl 命令在我的rails 应用程序上创建一个用户。无论我如何格式化数据,应用程序都会返回我的验证均未通过的响应。
curl http://localhost:3000/api/1/users.json -i -X POST -d {"user":{"first_name":"firstname","last_name":"lastname","email":"[email protected]","password":"app123","password_confirmation":"app123"}}"
我尝试了所有的变化。我尝试过使用 [] 括号,我尝试过 user={data..} 但似乎没有任何效果。有什么想法吗?
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":"[email protected]","password":"app123","password_confirmation":"app123"}}"
I've tried every variation. I've tried using [] brackets, I've tried user={data..} and nothing seems to work. Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,命令末尾有一个无关的“。
试试这个
First off, there is an extraneous " at the end of your command.
Try this