forked from wf4ever/apis
-
Notifications
You must be signed in to change notification settings - Fork 0
Comments API
gosiawolniewicz edited this page Mar 17, 2020
·
4 revisions
Comments API is responsible for collecting and managing user comments.
Send following JSON message in order to create comment:
{ "text":"", "authorName":"", "resource" : "", "parentHash":"" }
When obtaining comment from service the following JSON will be send. _links section contains links to this, parent and response messages.
{ "text" : "", "authorName" : "", "parentHash" : "", "resource" : "", "created" : "", "modified" : "", "hash" : "", "voteUp" : , "voteDown" : , "_links" : { "self" : { "href" : "http://beta.rohub.org/comments/api/comments/{comment_id}" }, "comment" : { "href" : "http://beta.rohub.org/comments/api/comments/{comment_id}" }, "parent" : { "href" : "http://beta.rohub.org/comments/api/comments/{comment_id}/parent" }, "responses" : { "href" : "http://beta.rohub.org/comments/api/comments/{comment_id}/responses" } }
In order to create comment, comment JSON message must by send in request body. POST -H "Content-Type: application/json" /api/comments
GET -H "Accept: application/json" /api/comments 3.3 Get all comments with pagination GET -H "Accept: application/json" /api/comments{?page,size,sort}
GET -H "Accept: application/json" /api/comments/{comment_id} 3.3 Get parent comment GET -H "Accept: application/json" /api/comments/{comment_id}/parent 3.3 Get get responses for this comment GET -H "Accept: application/json" /api/comments/{comment_id}/responses
Get first level comments associated with particular resource, the one without parent comment
GET -H "Accept: application/json" /api/comments/search/resource{?res,page,size,sort}
Get first level comments associated with particular ro, the one without parent comment
GET -H "Accept: application/json" /api/comments/search/ro{?ro,page,size,sort}
PUT -H "Accept: application/json" /api/comments/{comment_id}/voteup
PUT -H "Accept: application/json" /api/comments/{comment_id}/votedown 3.8 Get thread GET -H "Accept: application/json" /api/comments/{comment_id}/thread
New comment text must be send as JSON in request body
PUT -H "Content-Type: application/json" http://beta.rohub.org/comments/api/comments/{id} eg: curl -v -X PUT -H "Content-Type: application/json" --data-asci "{"text":"it must have text"}" http://beta.rohub.org/comments/api/comments/71
DELETE http://beta.rohub.org/comments/api/comments/{id}/