static
osapi.jive.corev3.comments
Static class for getting comments. Comments are created by calling createComment
on a Document
, Blog Post
, Poll
,
or Comment
. For example, see
createComment
for creating a comment
on a Document.
Examples:
Create a comment on a document
Here is an example of commenting on a document. You need to retrieve a document with documents.get,
then call createComment
on the returned object. This function returns a request object as usual.
//Create a comment on a document var document = ...; //given document var commentJSON = { subject : "Comment created at " + new Date(), content : { type: "text/html", text: "<p>Comment created using the V3 API!</p>" } }; var request = document.createComment(commentJSON); request.execute(function(data) { console.log("Comment created!", data); });
Get a comment by URI
Here is an example of getting a comment from its URI with all fields returned. We assume you have a URI of a comment already. Notice that the "fields" value can be a comma-delimited list of fields to return, or the special values "@all" and "@summary". Here we use "@all" to get all fields.
//Get a comment from its URI var commentURI = ...; //given URI var request = comments.get({ "uri": commentURI, "fields": "@all" }); request.execute(function(data) { console.log("Comment retrieved!", data); });