From 8a6c368eff5cb544ea72e862bea27f40146eda2b Mon Sep 17 00:00:00 2001 From: Adepoju Adebayo Date: Sat, 16 Jan 2016 22:32:35 +0100 Subject: [PATCH] add the remaining endpoints for questions to documentation --- docs/questions_endpoints.md | 69 ++++++++++++++++++++++++++++++++++++- 1 file changed, 68 insertions(+), 1 deletion(-) diff --git a/docs/questions_endpoints.md b/docs/questions_endpoints.md index 05071b7..8150d44 100644 --- a/docs/questions_endpoints.md +++ b/docs/questions_endpoints.md @@ -87,7 +87,7 @@ Request Response ```ruby -Status: 200 +Status: 201 { question: { id: 1, @@ -383,3 +383,70 @@ Status: 404 message: "No questions found" } ``` + +## PUT/PATCH /questions/:id +Request +```ruby + PUT/PATCH /questions/1 + params: { + title: "Edited Question Title", + description: "Edited Question Description", + user_id: "current user id", + tags: "tag 1", "tag 2", "tag 3" + } +``` + +Response +```ruby +Status: 200 + { + question: { + id: 1, + title: "Edited Question Title", + description: "Edited Question Description", + user_id: 1, + up_votes: 0 + down_votes: 0 + comment: [{ }], + answers: [{ + "No answers yet" + }], + tags: [{ + matches: [ "tag 1", "tag 2", "tag 3"] + }], + created_at: "2015-12-14T16:51:06.437Z", + updated_at: "2015-12-14T16:51:06.437Z", + } + }} +``` + +#### OR + +```ruby +Status: 403 + { + message: Error Message + } +``` +## DELETE /questions/:id +Request +```ruby + DELETE /questions/1 +``` + +Response +```ruby +Status: 200 +{ + message: "Question deleted successfully" +} +``` + +#### OR + +```ruby +Status: 403 + { + message: Error Message + } +```