alfresco-js-api
Version:
JavaScript client library for the Alfresco REST API
237 lines (161 loc) • 7.89 kB
Markdown
//localhost/alfresco/api/-default-/public/alfresco/versions/1*
Method | HTTP request | Description
------------- | ------------- | -------------
[**addComment**](CommentsApi.md
[**getComments**](CommentsApi.md
[**removeComment**](CommentsApi.md
[**updateComment**](CommentsApi.md
<a name="addComment"></a>
> CommentEntry addComment(nodeId, commentBody)
Add a comment
Creates one or more comments on node **nodeId**. You can create more than one comment by
specifying a list of comments in the JSON body like this:
```JSON
[
{
"content": "This is a comment"
},
{
"content": "This is another comment"
}
]
```
```javascript
var nodeId = "nodeId_example"; // {String} The identifier of a node.
var commentBody = new this.alfrescoJsApi.core.CommentBody(); // {CommentBody} The comment text. Note that you can provide an array of comments.
this.alfrescoJsApi.core.commentsApi.addComment(nodeId, commentBody).then(function(data) {
console.log('API called successfully. Returned data: ' + data);
}, function(error) {
console.error(error);
});
```
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**nodeId** | **String**| The identifier of a node. |
**commentBody** | [**CommentBody**](CommentBody.md)| The comment text. Note that you can provide an array of comments. |
[**CommentEntry**](CommentEntry.md)
[ ](../README.md
- **Content-Type**: application/json
- **Accept**: application/json
<a name="getComments"></a>
> CommentPaging getComments(nodeId, opts)
Get comments
Returns a list of comments for the node identified by **nodeId**, sorted chronologically with the newest comment first.
### Example
```javascript
var nodeId = "nodeId_example"; // {String} The identifier of a node.
var opts = {
'skipCount': 56, // {Integer} The number of entities that exist in the collection before those included in this list.
'maxItems': 56, // {Integer} The maximum number of items to return in the list.
'fields': ["fields_example"] /* {[String]} A list of field names.
You can use this parameter to restrict the fields
returned within a response if, for example, you want to save on overall bandwidth.
The list applies to a returned individual
entity or entries within a collection.
If the API method also supports the **include**
parameter, then the fields specified in the **include**
parameter are returned in addition to those specified in the **fields** parameter. */
};
this.alfrescoJsApi.core.commentsApi.getComments(nodeId, opts).then(function(data) {
console.log('API called successfully. Returned data: ' + data);
}, function(error) {
console.error(error);
});
```
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**nodeId** | **String**| The identifier of a node. |
**skipCount** | **Integer**| The number of entities that exist in the collection before those included in this list. | [optional]
**maxItems** | **Integer**| The maximum number of items to return in the list. | [optional]
**fields** | [**[String]**](String.md)| A list of field names.
You can use this parameter to restrict the fields
returned within a response if, for example, you want to save on overall bandwidth.
The list applies to a returned individual
entity or entries within a collection.
If the API method also supports the **include**
parameter, then the fields specified in the **include**
parameter are returned in addition to those specified in the **fields** parameter.
| [optional]
[**CommentPaging**](CommentPaging.md)
[ ](../README.md
- **Content-Type**: application/json
- **Accept**: application/json
<a name="removeComment"></a>
> removeComment(nodeId, commentId)
Delete a comment
Removes the comment **commentId** from node **nodeId**.
```javascript
var nodeId = "nodeId_example"; // {String} The identifier of a node.
var commentId = "commentId_example"; // {String} The identifier of a comment.
this.alfrescoJsApi.core.commentsApi.removeComment(nodeId, commentId).then(function() {
console.log('API called successfully.');
}, function(error) {
console.error(error);
});
```
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**nodeId** | **String**| The identifier of a node. |
**commentId** | **String**| The identifier of a comment. |
null (empty response body)
[ ](../README.md
- **Content-Type**: application/json
- **Accept**: application/json
<a name="updateComment"></a>
> CommentEntry updateComment(nodeId, commentIdcommentBody, opts)
Update a comment
Updates an existing comment **commentId** on node **nodeId**.
### Example
```javascript
var nodeId = "nodeId_example"; // {String} The identifier of a node.
var commentId = "commentId_example"; // {String} The identifier of a comment.
var commentBody = new this.alfrescoJsApi.core.CommentBody1(); // {CommentBody1} The JSON representing the comment to be updated.
var opts = {
'fields': ["fields_example"] /* {[String]} A list of field names.
You can use this parameter to restrict the fields
returned within a response if, for example, you want to save on overall bandwidth.
The list applies to a returned individual
entity or entries within a collection.
If the API method also supports the **include**
parameter, then the fields specified in the **include**
parameter are returned in addition to those specified in the **fields** parameter. */
};
this.alfrescoJsApi.core.commentsApi.updateComment(nodeId, commentIdcommentBody, opts).then(function(data) {
console.log('API called successfully. Returned data: ' + data);
}, function(error) {
console.error(error);
});
```
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**nodeId** | **String**| The identifier of a node. |
**commentId** | **String**| The identifier of a comment. |
**commentBody** | [**CommentBody1**](CommentBody1.md)| The JSON representing the comment to be updated. |
**fields** | [**[String]**](String.md)| A list of field names. You can use this parameter to restrict the fields returned within a response if, for example, you want to save on overall bandwidth. The list applies to a returned individual entity or entries within a collection. If the API method also supports the **include** parameter, then the fields specified in the **include** parameter are returned in addition to those specified in the **fields** parameter. | [optional]
[**CommentEntry**](CommentEntry.md)
[ ](../README.md
- **Content-Type**: application/json
- **Accept**: application/json
All URIs are relative to *https: