Repository navigation
Issue #218 Added Requests API documentation - #229
Conversation
| errors: "Some error message" | ||
| } | ||
|
|
||
| ## Mentor Request | Create [/api/v1/requests{?user_id,details,language,service_id,requested_mentor_id,status,assigned_mentor_id}] |
There was a problem hiding this comment.
Since the model name is Request and the endpoint is also requests, can you please change this to "Request a Mentor", and then re-alphabetize all of the Request related endpoints accordingly.
| } | ||
|
|
||
|
|
||
| ## Mentor Request | Update [/api/v1/requests{?user_id,details,language,service_id,requested_mentor_id,status,assigned_mentor_id}] |
There was a problem hiding this comment.
The update endpoint takes the request_id as a part of the url itself, not a parameter.
Here is an example from TeamMember#update.
| + Body | ||
|
|
||
| { | ||
| "user_id": 4600, |
There was a problem hiding this comment.
This will also include the id: of the newly created Request db record.
| errors: "Some error message" | ||
| } | ||
|
|
||
| ## Mentor Request | Show [/api/v1/requests{?user_id}] |
There was a problem hiding this comment.
The show endpoint takes the request_id as a part of the url itself, not a parameter.
Here is an example from CodeSchool#show.
|
|
||
| + Response 400 (application/json) | ||
|
|
||
| ## Mentor Requests Unclaimed | Show [/api/v1/requests] |
There was a problem hiding this comment.
This is actually "Collection" instead of a "Show"
|
|
||
| [ | ||
| { | ||
| "service_id": 223, |
There was a problem hiding this comment.
The id: will be included for each one of these records
| + Body | ||
|
|
||
| { | ||
| "user_id": 5200, |
There was a problem hiding this comment.
The id: will be included for the record
There was a problem hiding this comment.
I included the value, but I think because I did "id" and not "id:" github isn't registering correctly?
There was a problem hiding this comment.
Yeah, force of (Ruby) habit. In this API documentation it is "id".
|
|
||
| ## Scholarship Applications | Create [/api/v1/code_schools/{?scholarship_application,reason,terms_accepted,scholarship_id}] | ||
| + Parameters | ||
|
|
| error: 'No such record' | ||
| } | ||
|
|
||
| ## Scholarship Applications | Create [/api/v1/code_schools/{?scholarship_application,reason,terms_accepted,scholarship_id}] |
There was a problem hiding this comment.
The URL is /api/v1/scholarship_applications
|
@wimo7083 - Can you please pull out the code changes for Issue #218 out of this PR, and create a dedicated PR for that issue. So that we have a 1:1 relationship, in that every issue has its own resolving PR. |
|
Updated, split PR, and renamed since you reviewed mentorships in this one. |
| errors: "Some error message" | ||
| } | ||
|
|
||
| ## Mentor Request | Create a New Mentor Request [/api/v1/requests{?user_id,details,language,service_id,requested_mentor_id,status,assigned_mentor_id}] |
There was a problem hiding this comment.
Since the model name is Request and the endpoint is also ../requests, can you please all of these endpoints to begin with "Request ....". For example, "Request a Mentor".
And then re-alphabetize all of the Request related endpoints accordingly.
There was a problem hiding this comment.
I'll fix them to be like this:
## Mentor Request | Request .... r [/api/vi/....]
There was a problem hiding this comment.
They'll need to go by their model, Request, so it would be:
## Request | Request a Mentor .... r [/api/vi/....]
| ## Mentor Request | Create a New Mentor Request [/api/v1/requests{?user_id,details,language,service_id,requested_mentor_id,status,assigned_mentor_id}] | ||
| + Parameters | ||
|
|
||
| + user_id (integer, required) - Identification of the User requesting a mentor in the form of an integer |
There was a problem hiding this comment.
Since the passed user must also be verified, perhaps also include that information in this description. i.e. "The passed in user must be a verified military veteran (i.e. user.verified == true)."
| "assigned_mentor_id": 250 | ||
| } | ||
|
|
||
| + Response 422 (application/json) |
There was a problem hiding this comment.
The create action is current not accounting for an error response.
Here is an example of a different controller method that is accounting for error handling.
As such, you can adjust this whole section to return a 401, like you did in the index action.
| + Body | ||
|
|
||
| { | ||
| "request_id": 1234, |
There was a problem hiding this comment.
This attribute will just be "id"
| + request_id (integer, required) - Indentification of mentor request in the form of an integer | ||
|
|
||
|
|
||
| ### Show an Exiting Request From User ID [POST] |
|
|
||
| Authorization: Bearer Access-Token | ||
|
|
||
| + Body |
There was a problem hiding this comment.
In this case, the id is supplied as part of the url itself, and there will be no body in the request.
There was a problem hiding this comment.
I'm confused, so there's no body in the update of the request?
Frontend, to me this looks like it's passing the id in the url like you say, but there's a body in the request that contains status and mentor. But then here shows that the update takes in request params.
I compared the syntax for both update with Request controller and User controller and they both have the same type of input with params. The only difference is one uses obj.update and the other uses obj.update_attributes.
So i thought maybe this has to do with the difference. But this states that the only difference in behavior of the two functions it the return value for a success vs failure. update_attributes returns false if it fails validation, update returns the new object if it fails validation.
At this point I'm thorougly confused why there isn't a body in the request.
I also used a PUT here but changed it to PATCH based on the information provided in the frontend axios call.
There was a problem hiding this comment.
@wimo7083 - Apologies, I miscommunicated that. My intent was to say that the id would not be in the body, rather in the url itself. And yes, you're correct, there is a body in the request with all the attributes you have below.
| error: 'Unauthorized' | ||
| } | ||
|
|
||
| ## Mentor Request | Update [/api/v1/requests{user_id}{?details,language,service_id,requested_mentor_id,status,assigned_mentor_id}] |
There was a problem hiding this comment.
There will be a / after requests because the id is part of the url itself, i.e. /api/v1/requests/{user_id}{?details,language....
Description of changes
Completes request for Issue #218 adds documentation for:
api/v1/requests_controller#index
api/v1/requests_controller#create
api/v1/requests_controller#show
api/v1/requests_controller#update
Issue Resolved
Fixes #218