Comment
Comment Service
Web service endpoints for comments.
Examples:
POST to /comments
with the parent
field containing the URI of
a content object or another comment. Suppose you have a blog post with URI "http://example.jiveon.com/api/core/v3/contents/1234".
Then the following curl command will comment on this post.
curl -u joe.employee:password -H "Content-Type: application/json" --data '{ "type": "comment", "content":
{ "type": "text/html", "text":"<p>Your ideas for our budget are great!</p>"}, "subject": "Insightful blog post",
"parent": "http://example.jiveon.com/api/core/v3/contents/1234"}' http://example.jiveon.com/api/core/v3/comments
In order to like a comment, you must POST to /comments/{commentID}/likes
with an empty request body. Note that
a user cannot like her own comments, so you must like a comment with different credentials. Curl example:
curl -u another.user:password -X POST http://example.jiveon.com/api/core/v3/comments/1234/likes
Create Comment
POST /comments
Create a new comment with the specified characteristics. The parent
field must
contain the URI of either a content object for which this is a direct reply, or the URI of a
previous comment to which this is a reply.
Query Parameters:
Name | Type | Required | Description |
---|---|---|---|
author | Boolean | false | Flag indicating if new comment is an author comment or a regular comment (only valid for documents). By default a regular comment will be created. |
fields | String | false | Fields to include in the returned Comment |
Takes:
Return Status:
HTTP Status Code | Description |
---|---|
201 (Created) | Request was successful |
400 (Bad Request) | An input field is missing or malformed |
409 (Conflict) | You attempt to add a comment to a content object that does not support them, or for which comments have been closed |
403 (Forbidden) | You are not allowed to perform this operation |
404 (Not Found) | The specified parent content object (or comment) cannot be found |
Create Comment Like
POST /comments/{commentID}/likes
Register that the requesting person likes the specified comment.
Path Parameters:
Name | Type | Required | Description |
---|---|---|---|
commentID | String | true | ID of the comment to be liked |
Return Status:
HTTP Status Code | Description |
---|---|
204 (No Content) | Request was successful |
400 (Bad Request) | An input field is missing or malformed |
403 (Forbidden) | You are not allowed to access or like this comment |
404 (Not Found) | The specified comment does not exist |
Create Reply
POST /comments/{commentID}/comments
Create a new comment as a reply to an existing comment with the specified characteristics.
Path Parameters:
Name | Type | Required | Description |
---|---|---|---|
commentID | String | true | ID of the comment being replied to |
Query Parameters:
Name | Type | Required | Description |
---|---|---|---|
fields | String | false | Fields to include in the returned Comment |
Takes:
Retrieves:
Return Status:
HTTP Status Code | Description |
---|---|
201 (Created) | Request was successful |
400 (Bad Request) | An input field is missing or malformed |
409 (Conflict) | You attempted to add a comment to a content object that does not support them, or for which comments have been closed |
403 (Forbidden) | You are not allowed to perform this operation |
404 (Not Found) | The specified parent content object (or comment) cannot be found |
Destroy Comment
DELETE /comments/{commentID}
Delete the specified comment.
Path Parameters:
Name | Type | Required | Description |
---|---|---|---|
commentID | String | true | ID of the comment to be deleted |
Return Status:
HTTP Status Code | Description |
---|---|
204 (No Content) | Request was successful |
400 (Bad Request) | An input field is missing or malformed |
403 (Forbidden) | You are not allowed to access the specified comment |
404 (Not Found) | The specified comment does not exist |
Destroy Comment Like
DELETE /comments/{commentID}/likes
Delete the like of the specified content object by the requesting user.
Path Parameters:
Name | Type | Required | Description |
---|---|---|---|
commentID | String | true | ID of the comment for which a like is being removed |
Return Status:
HTTP Status Code | Description |
---|---|
204 (No Content) | Request was successful |
400 (Bad Request) | Any input field is malformed |
409 (Conflict) | You do not currently have a like registered for this comment |
403 (Forbidden) | You are not allowed to access or unlike this comment |
404 (Not Found) | The specified comment does not exist |
Get Comment
GET /comments/{commentID}
Return the specified content object with the specified fields.
Path Parameters:
Name | Type | Required | Description |
---|---|---|---|
commentID | String | true | ID of the comment to be returned |
Query Parameters:
Name | Type | Required | Description |
---|---|---|---|
fields | String | false | Fields to be returned |
abridged | Boolean | false | Flag indicating that if content.text is requested, it will be abridged
(length shortened, HTML tags removed) |
Retrieves:
Return Status:
HTTP Status Code | Description |
---|---|
200 (OK) | Request was successful |
400 (Bad Request) | An input field is missing or malformed |
403 (Forbidden) | You are not allowed to access the specified comment |
404 (Not Found) | The specified comment does not exist |
Get Comment Likes
GET /comments/{commentID}/likes
Return a paginated list of the people who like the specified comment.
Path Parameters:
Name | Type | Required | Description |
---|---|---|---|
commentID | String | true | ID of the comment for which to return liking people |
Query Parameters:
Name | Type | Required | Description |
---|---|---|---|
startIndex | Integer | false | Zero-relative index of the first person to be returned |
count | Integer | false | Maximum number of people to be returned |
fields | String | false | Fields to be returned on liking people |
Retrieves:
Return Status:
HTTP Status Code | Description |
---|---|
200 (OK) | Request was successful |
400 (Bad Request) | An input field is missing or malformed |
403 (Forbidden) | You are not allowed to access this comment |
404 (Not Found) | The specified comment does not exist |
Get Comments
GET /comments/{commentID}/comments
Return a paginated list of comments to the specified content object, optionally limiting the returned results to direct replies only. The specified content object type must support comments, or be a comment itself (in which case replies to this comment only are returned).
Path Parameters:
Name | Type | Required | Description |
---|---|---|---|
commentID | String | true | ID of the comment for which to return reply comments |
Query Parameters:
Name | Type | Required | Description |
---|---|---|---|
excludeReplies | Boolean | false | Flag indicating whether to exclude replies (and therefore return direct replies only) |
startIndex | Integer | false | Zero-relative index of the first comment to be returned |
count | Integer | false | Maximum number of comments to be returned |
anchor | String | false | optional URI for a comment to anchor at. Specifying a anchor will try to return the page containing the anchor. If the anchor could not be found then the first page of comments will be returned. |
fields | String | false | Fields to be returned in the selected comments |
Retrieves:
Return Status:
HTTP Status Code | Description |
---|---|
200 (OK) | Request was successful |
400 (Bad Request) | An input field is missing or malformed |
403 (Forbidden) | You are not allowed to access the specified comment or its replies |
404 (Not Found) | The specified comment does not exist |
Update Comment
PUT /comments/{commentID}
Update the specified comment with the specified characteristics.
Path Parameters:
Name | Type | Required | Description |
---|---|---|---|
commentID | String | true | ID of the comment to be updated |
Query Parameters:
Name | Type | Required | Description |
---|---|---|---|
fields | String | false | Fields to include in the returned entity |
Takes:
Retrieves:
Return Status:
HTTP Status Code | Description |
---|---|
200 (OK) | Request was successful |
400 (Bad Request) | An input field is missing or malformed |
409 (Conflict) | You attempt to add a comment to a content object that does not support them, or for which comments have been closed |
403 (Forbidden) | You are not allowed to access the specified comment |
404 (Not Found) | The specified comment does not exist |