Comment Service

ResourceDescription
Attach imageAttaches a image to the given comment.
Create commentCreates a reply to the comment with the given id.
Delete commentDeletes the comment with the given id.
Delete likeDeletes the user's like of the specified content object
Get commentRetrieves the comment with the given id
Get imagesGets all images attached to the given comment
Get likeIndicates whether the user likes the specified content object.
Get likesGets a list of all users that like the specified content object
Get repliesReturns the latest replies to the given comment sorted by the date they were created (oldest first).
LikeAdds a like to the specified content object
Update commentUpdates the comment with the given id.

Attach image

Attaches a image to the given comment.

POST http://domain:port/application_context/api/core/v2/comments/{id}/images

Path Parameters

NameTypeDescriptionDefault Value
idlongthe system wide unique identifier for the comment 

Post Payload

NameTypeDescriptionDefault Value
bodyMultipartBodythe multi-part body that contains the image binary 

Response

TypeDescription
Responsea HTTP 201 response including the URL for the uploaded image in the Location header

Create comment

Creates a reply to the comment with the given id.

POST http://domain:port/application_context/api/core/v2/comments/{id}/replies

Path Parameters

NameTypeDescriptionDefault Value
idlongthe system wide unique identifier for the comment being replied to 

Form Parameters

NameTypeDescriptionDefault Value
htmlDocumentParamthe html body of the reply 

Response

TypeDescription
Responsea HTTP 201 response including the URL for the created reply in the Location header

Example

Form Payload
html=%3Cdiv+class%3D%22jive-rendered-content%22%3EFoobar%3C%2Fdiv%3E

Delete comment

Deletes the comment with the given id.

DELETE http://domain:port/application_context/api/core/v2/comments/{id}

Path Parameters

NameTypeDescriptionDefault Value
idlongthe system wide unique identifier for the comment to delete 

Response

TypeDescription
void

Delete like

Deletes the user's like of the specified content object

DELETE http://domain:port/application_context/api/core/v2/comments/{id}/likes/{userID}

Path Parameters

NameTypeDescriptionDefault Value
idlongthe system wide unique identifier for the content object 
userIDlongthe system wide unique identifier for the user 

Response

TypeDescription
void

Get comment

Retrieves the comment with the given id

GET http://domain:port/application_context/api/core/v2/comments/{id}

Path Parameters

NameTypeDescriptionDefault Value
idlongthe system wide unique identifier for the comment 

Response

TypeDescription
Commentthe JSON representation of the comment

Example

JSON Response Payload
{
  "replyCount" : 0,
  "content" : {
    "type" : "html",
    "body" : "<body><!-- [DocumentBodyStart:b88200a7-1099-4389-b6ea-c93e40858f99] --><div class=\"jive-rendered-content\"><p>This is a test comment</p></div><!-- [DocumentBodyEnd:b88200a7-1099-4389-b6ea-c93e40858f99] --></body>"
  },
  "status" : "published",
  "author" : {
    "username" : "user-c32deto2nt5lw5ie",
    "id" : 2000,
    "type" : 3,
    "links" : {
      "alt" : "http://localhost:50001/oc/v1/users/2000",
        "avatar" : "http://localhost:50001/oc/v1/avatars/default"
    }
  },
  "id" : 1000,
  "type" : 105,
  "creationDate" : "2010-08-03T16:11:27.597+0000",
  "modificationDate" : "2010-08-03T16:11:27.597+0000",
  "links" : {
    "content" : "http://localhost:50001/oc/v1/updates/1000",
    "children" : "http://localhost:50001/oc/v1/comments/1000/replies"
  }
}

Get images

Gets all images attached to the given comment

GET http://domain:port/application_context/api/core/v2/comments/{id}/images

Path Parameters

NameTypeDescriptionDefault Value
idlongthe system wide unique identifier for the comment 

Response

TypeDescription
List of ImageEntitya collection of images attached to the comment

Example

JSON Response Payload
[ {
  "size" : 16470,
  "ref" : "http://localhost:50001/oc/v1/images/1004",
  "contentType" : "image/png",
  "id" : 1004,
  "type" : 111
}, {
  "size" : 602438,
  "ref" : "http://localhost:50001/oc/v1/images/1006",
  "contentType" : "image/png",
  "id" : 1006,
  "type" : 111
} ]

Get like

Indicates whether the user likes the specified content object.

GET http://domain:port/application_context/api/core/v2/comments/{id}/likes/{userID}

Path Parameters

NameTypeDescriptionDefault Value
idlongthe system wide unique identifier for the content object 
userIDlongthe system wide unique identifier for the user 

Response

TypeDescription
UserSummarythe user summary if the specified user likes the content object or a HTTP 404 if the user does not like the content object

Get likes

Gets a list of all users that like the specified content object

GET http://domain:port/application_context/api/core/v2/comments/{id}/likes

Path Parameters

NameTypeDescriptionDefault Value
idlongthe system wide unique identifier for the content object 

Response

TypeDescription
EntityCollectiona collection of user summaries for the users that like the content object

Example

JSON Response Payload
TBD

Get replies

Returns the latest replies to the given comment sorted by the date they were created (oldest first). Note that this method only returns direct replies, i.e. replies to replies and so on are not returned.

GET http://domain:port/application_context/api/core/v2/comments/{id}/replies?offset=int&limit=int

Path Parameters

NameTypeDescriptionDefault Value
idlongthe system wide unique identifier for the parent comment 

Query Parameters

NameTypeDescriptionDefault Value
offsetintthe number of results which should be skipped in the returned collection. For instance, if the first 25 results have already been retrieved then results after the 25th result can be retrieved by specifying an offset of 25. The minimum value for the offset is 0, specifying anything less than 0 for the offset will result in an exception."0"
limitintthe maximum number of comments to return. If there are fewer comments available in the given time period, if either after or before is provided, then fewer comments will be returned then the limit."25"

Response

TypeDescription
EntityCollectiona collection of replies to the comment ordered by the date they were created (oldest to newest).

Example

JSON Response Payload  (No Pagination)

{
  "data" : [ {
    "replyCount" : 0,
    "content" : {
      "type" : "html",
      "body" : "<body><!-- [DocumentBodyStart:92b15e08-2417-43ce-a4ff-a562cf1789c5] --><div class=\"jive-rendered-content\"><p>This is another child comment</p></div><!-- [DocumentBodyEnd:92b15e08-2417-43ce-a4ff-a562cf1789c5] --></body>"
    },
    "status" : "published",
    "author" : {
      "username" : "user-e0o85wkluj1addeh",
      "id" : 2008,
      "type" : 3,
      "links" : {
        "alt" : "http://localhost:50001/oc/v1/users/2008",
        "avatar" : "http://localhost:50001/oc/v1/avatars/default"
      }
    },
    "id" : 1007,
    "type" : 105,
    "creationDate" : "2010-08-03T16:11:28.911+0000",
    "modificationDate" : "2010-08-03T16:11:28.911+0000",
    "links" : {
      "content" : "http://localhost:50001/oc/v1/updates/1004",
      "children" : "http://localhost:50001/oc/v1/comments/1007/replies",
      "parent" : "http://localhost:50001/oc/v1/comments/1005"
    }
  }, {
    "replyCount" : 0,
    "content" : {
      "type" : "html",
      "body" : "<body><!-- [DocumentBodyStart:fc7ca51a-c9ed-44e5-916d-5663c326c3c5] --><div class=\"jive-rendered-content\"><p>This is a child comment</p></div><!-- [DocumentBodyEnd:fc7ca51a-c9ed-44e5-916d-5663c326c3c5] --></body>"
    },
    "status" : "published",
    "author" : {
      "username" : "user-e0o85wkluj1addeh",
      "id" : 2008,
      "type" : 3,
      "links" : {
        "alt" : "http://localhost:50001/oc/v1/users/2008",
        "avatar" : "http://localhost:50001/oc/v1/avatars/default"
      }
    },
    "id" : 1006,
    "type" : 105,
    "creationDate" : "2010-08-03T16:11:28.900+0000",
    "modificationDate" : "2010-08-03T16:11:28.900+0000",
    "links" : {
      "content" : "http://localhost:50001/oc/v1/updates/1004",
      "children" : "http://localhost:50001/oc/v1/comments/1006/replies",
      "parent" : "http://localhost:50001/oc/v1/comments/1005"
    }
  } ]
}
 JSON Response (Pagination)

"data" : [ {
    "replyCount" : 0,
    "content" : {
      "type" : "html",
      "body" : "<body><!-- [DocumentBodyStart:16669681-7fe2-4beb-8331-ec43a5f2883f] --><div class=\"jive-rendered-content\"><p>This is child comment #54</p></div><!-- [DocumentBodyEnd:16669681-7fe2-4beb-8331-ec43a5f2883f] --></body>"
    },
    "status" : "published",
    "author" : {
      "username" : "user-rvcixvvtkcpurhwh",
      "id" : 2010,
      "type" : 3,
      "links" : {
        "alt" : "http://localhost:50001/oc/v1/users/2010",
        "avatar" : "http://localhost:50001/oc/v1/avatars/default"
      }
    },
    "id" : 1064,
    "type" : 105,
    "creationDate" : "2010-08-03T16:11:30.387+0000",
    "modificationDate" : "2010-08-03T16:11:30.387+0000",
    "links" : {
      "content" : "http://localhost:50001/oc/v1/updates/1006",
      "children" : "http://localhost:50001/oc/v1/comments/1064/replies",
      "parent" : "http://localhost:50001/oc/v1/comments/1009"
    }
  },{
    "replyCount" : 0,
    "content" : {
      "type" : "html",
      "body" : "<body><!-- [DocumentBodyStart:d6af1e85-638a-4156-ad97-00b1f0c7c0ac] --><div class=\"jive-rendered-content\"><p>This is child comment #35</p></div><!-- [DocumentBodyEnd:d6af1e85-638a-4156-ad97-00b1f0c7c0ac] --></body>"
    },
    "status" : "published",
    "author" : {
      "username" : "user-rvcixvvtkcpurhwh",
      "id" : 2010,
      "type" : 3,
      "links" : {
        "alt" : "http://localhost:50001/oc/v1/users/2010",
        "avatar" : "http://localhost:50001/oc/v1/avatars/default"
      }
    },
    "id" : 1045,
    "type" : 105,
    "creationDate" : "2010-08-03T16:11:29.989+0000",
    "modificationDate" : "2010-08-03T16:11:29.989+0000",
    "links" : {
      "content" : "http://localhost:50001/oc/v1/updates/1006",
      "children" : "http://localhost:50001/oc/v1/comments/1045/replies",
      "parent" : "http://localhost:50001/oc/v1/comments/1009"
    }
  } ],
  "links" : {
    "next" : "http://localhost:50001/oc/v1/comments/1009/replies?limit=20&before=2010-08-03T16%253A11%253A29.989%252B0000",
    "previous" : "http://localhost:50001/oc/v1/comments/1009/replies?limit=20&after=2010-08-03T16%253A11%253A30.387%252B0000"
  }
}

Like

Adds a like to the specified content object

POST http://domain:port/application_context/api/core/v2/comments/{id}/likes

Path Parameters

NameTypeDescriptionDefault Value
idlongthe system wide unique identifier for the content object 

Response

TypeDescription
Responsea HTTP 201 response including the URL for the "like" in the Location header. If this method is called more than once for the same authenticated user then a HTTP 403 status will be returned.

Update comment

Updates the comment with the given id.

PUT http://domain:port/application_context/api/core/v2/comments/{id}

Path Parameters

NameTypeDescriptionDefault Value
idlongthe system wide unique identifier for the comment being updated 

Response

TypeDescription
CommentThe JSON representation of the updates comment

Example

JSON Request Payload
{"content":{"body":"<div class=\"jive-rendered-content\">Foobar<\/div>","type":"html"}}

  JSON Response Payload
{
  "replyCount" : 0,
  "content" : {
    "type" : "html",
    "body" : "<body><!-- [DocumentBodyStart:2573d60a-3ae8-4ce9-a67e-16e770ecb0f9] --><div class=\"jive-rendered-content\"><div class=\"jive-rendered-content\">Foobar</div></div><!-- [DocumentBodyEnd:2573d60a-3ae8-4ce9-a67e-16e770ecb0f9] --></body>"
  },
  "status" : "published",
  "author" : {
    "username" : "user-8f0kvd9c9j632f85",
    "id" : 2002,
    "type" : 3,
    "links" : {
      "alt" : "http://localhost:50001/oc/v1/users/2002",
        "avatar" : "http://localhost:50001/oc/v1/avatars/default"
    }
  },
  "id" : 1001,
  "type" : 105,
  "creationDate" : "2010-08-03T16:11:28.136+0000",
  "modificationDate" : "2010-08-03T16:11:28.136+0000",
  "links" : {
    "content" : "http://localhost:50001/oc/v1/updates/1001",
    "children" : "http://localhost:50001/oc/v1/comments/1001/replies"
  }
}