Comment

Comment Service

Web service endpoints for comments.

Examples:
Create Comment

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

Like a Comment

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:
NameTypeRequiredDescription
authorBooleanfalseFlag indicating if new comment is an author comment or a regular comment (only valid for documents). By default a regular comment will be created.
fieldsStringfalseFields to include in the returned Comment
Takes:
  • Comment describing the comment to be created
  • Return Status:
    HTTP Status CodeDescription
    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:
    NameTypeRequiredDescription
    commentIDStringtrueID of the comment to be liked
    Return Status:
    HTTP Status CodeDescription
    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:
    NameTypeRequiredDescription
    commentIDStringtrueID of the comment being replied to
    Query Parameters:
    NameTypeRequiredDescription
    fieldsStringfalseFields to include in the returned Comment
    Takes:
  • Comment describing the reply comment to be created
  • Retrieves:
  • Comment describing the new reply comment
  • Return Status:
    HTTP Status CodeDescription
    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:
    NameTypeRequiredDescription
    commentIDStringtrueID of the comment to be deleted
    Return Status:
    HTTP Status CodeDescription
    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:
    NameTypeRequiredDescription
    commentIDStringtrueID of the comment for which a like is being removed
    Return Status:
    HTTP Status CodeDescription
    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:
    NameTypeRequiredDescription
    commentIDStringtrueID of the comment to be returned
    Query Parameters:
    NameTypeRequiredDescription
    fieldsStringfalseFields to be returned
    abridgedBooleanfalseFlag indicating that if content.text is requested, it will be abridged (length shortened, HTML tags removed)
    Retrieves:
  • Comment containing the specified comment
  • Return Status:
    HTTP Status CodeDescription
    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:
    NameTypeRequiredDescription
    commentIDStringtrueID of the comment for which to return liking people
    Query Parameters:
    NameTypeRequiredDescription
    startIndexIntegerfalseZero-relative index of the first person to be returned
    countIntegerfalseMaximum number of people to be returned
    fieldsStringfalseFields to be returned on liking people
    Retrieves:
  • Person[] listint the people who like the specified comment
  • Return Status:
    HTTP Status CodeDescription
    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:
    NameTypeRequiredDescription
    commentIDStringtrueID of the comment for which to return reply comments
    Query Parameters:
    NameTypeRequiredDescription
    excludeRepliesBooleanfalseFlag indicating whether to exclude replies (and therefore return direct replies only)
    startIndexIntegerfalseZero-relative index of the first comment to be returned
    countIntegerfalseMaximum number of comments to be returned
    anchorStringfalseoptional 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.
    fieldsStringfalseFields to be returned in the selected comments
    Retrieves:
  • Comment[]
  • Return Status:
    HTTP Status CodeDescription
    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:
    NameTypeRequiredDescription
    commentIDStringtrueID of the comment to be updated
    Query Parameters:
    NameTypeRequiredDescription
    fieldsStringfalseFields to include in the returned entity
    Takes:
  • Comment containing the updated comment
  • Retrieves:
  • Comment representing the updated comment
  • Return Status:
    HTTP Status CodeDescription
    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