Repository navigation
Documentation for sessions_controller#create & resources_controller#destroy - #279
Conversation
| + Response 400 (application/json) | ||
|
|
||
| ## Resource [/api/v1/resources/{resource_id}] | ||
| ## Resource | Delete [/api/v1/resources/{resource_id}] |
There was a problem hiding this comment.
This would actually be the same route for both the Show or the Delete actions, similar to here:
https://github.com/OperationCode/operationcode_backend/blob/master/apiary.apib#L93
| { | ||
| "token" => some_long_string_of_characters, | ||
| "user" => { | ||
| "id" => 96, |
There was a problem hiding this comment.
You'll want to indent the contents of this user hash (i.e. lines 1047 - 1054)
|
|
||
| + Body | ||
|
|
||
| { |
There was a problem hiding this comment.
Based on these results from the params check you did in the controller:
<ActionController::Parameters {"user"=>{"email"=>"mekhi_kemmer@dooleycollier.info", "password"=>"pass123"}, "controller"=>"api/v1/sessions", "action"=>"create", "session"
=>{"user"=>{"email"=>"mekhi_kemmer@dooleycollier.info", "password"=>"pass123"}}, "format"=>"json"} permitted: false>
The request contains:
{"user"=>{"email"=>"mekhi_kemmer@dooleycollier.info", "password"=>"pass123"}}So you'll want to update the Body and parameters sections accordingly.
There was a problem hiding this comment.
fixed it to user, email and password
| } | ||
| ## Sessions | Create [/api/v1/sessions/user{?email,password}] | ||
| + Parameters | ||
|
|
There was a problem hiding this comment.
user is also passed, so you'll want to include that as a parameter. For it's type, you can use object.
|
|
||
| { | ||
| user: { | ||
| email: @user.email, |
There was a problem hiding this comment.
email is a string. Can you use something like 'john@example.com'.
| test 'returns JWT token for succesfull login' do | ||
| post api_v1_sessions_url, params: @user_params, as: :json | ||
| json = response.parsed_body | ||
| byebug |
There was a problem hiding this comment.
Accidentally slipped through :)
| errors: "Some error message" | ||
| } | ||
| ## Sessions | Create [/api/v1/sessions/user{?email,password}] | ||
| ## Sessions | Create [/api/v1/sessions/{?user,email,password}] |
There was a problem hiding this comment.
Remove the / in between sessions and {, and we should be good
Description of changes
documentation
Issue Resolved
Fixes #220