Skip to content

Latest commit

 

History

History
364 lines (272 loc) · 17 KB

CommentsApi.md

File metadata and controls

364 lines (272 loc) · 17 KB

alfresco_core_api_client.CommentsApi

All URIs are relative to http://localhost/alfresco/api/-default-/public/alfresco/versions/1

Method HTTP request Description
create_comment POST /nodes/{nodeId}/comments Create a comment
delete_comment DELETE /nodes/{nodeId}/comments/{commentId} Delete a comment
list_comments GET /nodes/{nodeId}/comments List comments
update_comment PUT /nodes/{nodeId}/comments/{commentId} Update a comment

create_comment

CommentEntry create_comment(node_id, comment_body_create, fields=fields)

Create a comment

Creates a comment on node nodeId. You specify the comment in a JSON body like this: JSON { \"content\": \"This is a comment\" } Note: 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\" } ] If you specify a list as input, then a paginated list rather than an entry is returned in the response body. For example: JSON { \"list\": { \"pagination\": { \"count\": 2, \"hasMoreItems\": false, \"totalItems\": 2, \"skipCount\": 0, \"maxItems\": 100 }, \"entries\": [ { \"entry\": { ... } }, { \"entry\": { ... } } ] } }

Example

  • Basic Authentication (basicAuth):
import time
import os
import alfresco_core_api_client
from alfresco_core_api_client.models.comment_body import CommentBody
from alfresco_core_api_client.models.comment_entry import CommentEntry
from alfresco_core_api_client.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to http://localhost/alfresco/api/-default-/public/alfresco/versions/1
# See configuration.py for a list of all supported configuration parameters.
configuration = alfresco_core_api_client.Configuration(
    host = "http://localhost/alfresco/api/-default-/public/alfresco/versions/1"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure HTTP basic authorization: basicAuth
configuration = alfresco_core_api_client.Configuration(
    username = os.environ["USERNAME"],
    password = os.environ["PASSWORD"]
)

# Enter a context with an instance of the API client
with alfresco_core_api_client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = alfresco_core_api_client.CommentsApi(api_client)
    node_id = 'node_id_example' # str | The identifier of a node.
    comment_body_create = alfresco_core_api_client.CommentBody() # CommentBody | The comment text. Note that you can also provide a list of comments.
    fields = ['fields_example'] # List[str] | 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)

    try:
        # Create a comment
        api_response = api_instance.create_comment(node_id, comment_body_create, fields=fields)
        print("The response of CommentsApi->create_comment:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling CommentsApi->create_comment: %s\n" % e)

Parameters

Name Type Description Notes
node_id str The identifier of a node.
comment_body_create CommentBody The comment text. Note that you can also provide a list of comments.
fields List[str] 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]

Return type

CommentEntry

Authorization

basicAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
201 Successful response -
400 Invalid parameter: commentBodyCreate is invalid -
401 Authentication failed -
403 User does not have permission to create a comment -
404 nodeId does not exist -
405 Cannot comment on a node of this type -
409 nodeId is locked and you are not the lock owner -
0 Unexpected error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

delete_comment

delete_comment(node_id, comment_id)

Delete a comment

Deletes the comment commentId from node nodeId.

Example

  • Basic Authentication (basicAuth):
import time
import os
import alfresco_core_api_client
from alfresco_core_api_client.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to http://localhost/alfresco/api/-default-/public/alfresco/versions/1
# See configuration.py for a list of all supported configuration parameters.
configuration = alfresco_core_api_client.Configuration(
    host = "http://localhost/alfresco/api/-default-/public/alfresco/versions/1"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure HTTP basic authorization: basicAuth
configuration = alfresco_core_api_client.Configuration(
    username = os.environ["USERNAME"],
    password = os.environ["PASSWORD"]
)

# Enter a context with an instance of the API client
with alfresco_core_api_client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = alfresco_core_api_client.CommentsApi(api_client)
    node_id = 'node_id_example' # str | The identifier of a node.
    comment_id = 'comment_id_example' # str | The identifier of a comment.

    try:
        # Delete a comment
        api_instance.delete_comment(node_id, comment_id)
    except Exception as e:
        print("Exception when calling CommentsApi->delete_comment: %s\n" % e)

Parameters

Name Type Description Notes
node_id str The identifier of a node.
comment_id str The identifier of a comment.

Return type

void (empty response body)

Authorization

basicAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
204 Successful response -
401 Authentication failed -
403 User does not have permission to delete a comment -
404 nodeId or commentId does not exist -
409 nodeId is locked and you are not the lock owner -
0 Unexpected error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

list_comments

CommentPaging list_comments(node_id, skip_count=skip_count, max_items=max_items, fields=fields)

List comments

Gets a list of comments for the node nodeId, sorted chronologically with the newest comment first.

Example

  • Basic Authentication (basicAuth):
import time
import os
import alfresco_core_api_client
from alfresco_core_api_client.models.comment_paging import CommentPaging
from alfresco_core_api_client.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to http://localhost/alfresco/api/-default-/public/alfresco/versions/1
# See configuration.py for a list of all supported configuration parameters.
configuration = alfresco_core_api_client.Configuration(
    host = "http://localhost/alfresco/api/-default-/public/alfresco/versions/1"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure HTTP basic authorization: basicAuth
configuration = alfresco_core_api_client.Configuration(
    username = os.environ["USERNAME"],
    password = os.environ["PASSWORD"]
)

# Enter a context with an instance of the API client
with alfresco_core_api_client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = alfresco_core_api_client.CommentsApi(api_client)
    node_id = 'node_id_example' # str | The identifier of a node.
    skip_count = 0 # int | The number of entities that exist in the collection before those included in this list. If not supplied then the default value is 0.  (optional) (default to 0)
    max_items = 100 # int | The maximum number of items to return in the list. If not supplied then the default value is 100.  (optional) (default to 100)
    fields = ['fields_example'] # List[str] | 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)

    try:
        # List comments
        api_response = api_instance.list_comments(node_id, skip_count=skip_count, max_items=max_items, fields=fields)
        print("The response of CommentsApi->list_comments:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling CommentsApi->list_comments: %s\n" % e)

Parameters

Name Type Description Notes
node_id str The identifier of a node.
skip_count int The number of entities that exist in the collection before those included in this list. If not supplied then the default value is 0. [optional] [default to 0]
max_items int The maximum number of items to return in the list. If not supplied then the default value is 100. [optional] [default to 100]
fields List[str] 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]

Return type

CommentPaging

Authorization

basicAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Successful response -
400 Invalid parameter: nodeId exists but does not identify a file or a folder, or the value of maxItems is invalid, or the value of skipCount is invalid -
401 Authentication failed -
403 User does not have permission read comments on the node -
404 nodeId does not exist -
0 Unexpected error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

update_comment

CommentEntry update_comment(node_id, comment_id, comment_body_update, fields=fields)

Update a comment

Updates an existing comment commentId on node nodeId.

Example

  • Basic Authentication (basicAuth):
import time
import os
import alfresco_core_api_client
from alfresco_core_api_client.models.comment_body import CommentBody
from alfresco_core_api_client.models.comment_entry import CommentEntry
from alfresco_core_api_client.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to http://localhost/alfresco/api/-default-/public/alfresco/versions/1
# See configuration.py for a list of all supported configuration parameters.
configuration = alfresco_core_api_client.Configuration(
    host = "http://localhost/alfresco/api/-default-/public/alfresco/versions/1"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure HTTP basic authorization: basicAuth
configuration = alfresco_core_api_client.Configuration(
    username = os.environ["USERNAME"],
    password = os.environ["PASSWORD"]
)

# Enter a context with an instance of the API client
with alfresco_core_api_client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = alfresco_core_api_client.CommentsApi(api_client)
    node_id = 'node_id_example' # str | The identifier of a node.
    comment_id = 'comment_id_example' # str | The identifier of a comment.
    comment_body_update = alfresco_core_api_client.CommentBody() # CommentBody | The JSON representing the comment to be updated.
    fields = ['fields_example'] # List[str] | 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)

    try:
        # Update a comment
        api_response = api_instance.update_comment(node_id, comment_id, comment_body_update, fields=fields)
        print("The response of CommentsApi->update_comment:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling CommentsApi->update_comment: %s\n" % e)

Parameters

Name Type Description Notes
node_id str The identifier of a node.
comment_id str The identifier of a comment.
comment_body_update CommentBody The JSON representing the comment to be updated.
fields List[str] 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]

Return type

CommentEntry

Authorization

basicAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Successful response -
400 Invalid parameter: commentBodyUpdate is invalid -
401 Authentication failed -
403 User does not have permission to update a comment -
404 nodeId or commentId does not exist -
409 nodeId is locked and you are not the lock owner -
0 Unexpected error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]