Commit cdc871a01cea9522647f72b1c6cec684e64f06fa
Committed by
Rodrigo Souto
1 parent
b8f96691
Exists in
master
and in
29 other branches
addding the possibility to add new comments by api
Showing
2 changed files
with
6 additions
and
1 deletions
Show diff stats
lib/api/v1/articles.rb
... | ... | @@ -14,7 +14,7 @@ module API |
14 | 14 | # limit - amount of comments returned. The default value is 20 |
15 | 15 | # |
16 | 16 | # Example Request: |
17 | - # GET /articles?from=2013-04-04-14:41:43&until=2014-04-04-14:41:43&limit=10&type=Blog | |
17 | + # GET /articles?from=2013-04-04-14:41:43&until=2014-04-04-14:41:43&limit=10&content_type=Hub | |
18 | 18 | # desc 'Articles.', { |
19 | 19 | # :params => API::Entities::Article.documentation |
20 | 20 | # } | ... | ... |
lib/api/v1/comments.rb
... | ... | @@ -25,6 +25,11 @@ module API |
25 | 25 | present environment.articles.find(params[:id]).comments.find(params[:comment_id]), :with => Entities::Comment |
26 | 26 | end |
27 | 27 | |
28 | + # Example Request: | |
29 | + # POST api/v1/articles/12/comments?private_toke=234298743290432&body=new comment | |
30 | + post ":id/comments" do | |
31 | + present environment.articles.find(params[:id]).comments.create(:author => current_user, :body => params[:body]), :with => Entities::Comment | |
32 | + end | |
28 | 33 | end |
29 | 34 | |
30 | 35 | end | ... | ... |