curl json post request via terminal to a rails app

后端 未结 1 1082
悲哀的现实
悲哀的现实 2020-12-02 04:06

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

相关标签:
1条回答
  • 2020-12-02 04:35

    First off, there is an extraneous " at the end of your command.

    Try this

    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
    
    0 讨论(0)
提交回复
热议问题