Skip to content

Instantly share code, notes, and snippets.

@viniciusalonso
Created December 2, 2015 21:47
Show Gist options
  • Save viniciusalonso/8b30eec6e77de7ee3f17 to your computer and use it in GitHub Desktop.
Save viniciusalonso/8b30eec6e77de7ee3f17 to your computer and use it in GitHub Desktop.
Hi, I'm writing a follow api
https://github.com/viniciusalonso/droid_doctor_api
I'm trying doing a POST to '/api/v1/patients' with a json below:
"{patient: {\"name\":\"Test\",\"age\":\"24\",\"sex\":\"m\",\"phone\":\"99000099\"}}" .
The api returned an error 400 bad request.
The heroku logs are:
2015-12-02T21:37:21.690782+00:00 app[web.1]: Processing by Api::V1::PatientsController#create as */*
2015-12-02T21:37:21.690874+00:00 app[web.1]: Can't verify CSRF token authenticity
2015-12-02T21:37:21.691148+00:00 app[web.1]: Completed 400 Bad Request in 0ms (ActiveRecord: 0.0ms)
2015-12-02T21:37:21.689012+00:00 app[web.1]: Started POST "/api/v1/patients" for 200.134.18.117 at 2015-12-02 21:37:21 +0000
2015-12-02T21:37:21.691863+00:00 app[web.1]:
2015-12-02T21:37:21.691864+00:00 app[web.1]: ActionController::ParameterMissing (param is missing or the value is empty: patient):
2015-12-02T21:37:21.691865+00:00 app[web.1]: app/controllers/api/v1/patients_controller.rb:26:in `patient_params'
2015-12-02T21:37:21.691865+00:00 app[web.1]: app/controllers/api/v1/patients_controller.rb:4:in `create'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment