Skip to content

Latest commit

 

History

History
355 lines (263 loc) · 15.5 KB

RatingsApi.md

File metadata and controls

355 lines (263 loc) · 15.5 KB

alfresco_core_api_client.RatingsApi

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

Method HTTP request Description
create_rating POST /nodes/{nodeId}/ratings Create a rating
delete_rating DELETE /nodes/{nodeId}/ratings/{ratingId} Delete a rating
get_rating GET /nodes/{nodeId}/ratings/{ratingId} Get a rating
list_ratings GET /nodes/{nodeId}/ratings List ratings

create_rating

RatingEntry create_rating(node_id, rating_body_create, fields=fields)

Create a rating

Create a rating for the node with identifier nodeId

Example

  • Basic Authentication (basicAuth):
import time
import os
import alfresco_core_api_client
from alfresco_core_api_client.models.rating_body import RatingBody
from alfresco_core_api_client.models.rating_entry import RatingEntry
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.RatingsApi(api_client)
    node_id = 'node_id_example' # str | The identifier of a node.
    rating_body_create = alfresco_core_api_client.RatingBody() # RatingBody | For \"myRating\" the type is specific to the rating scheme, boolean for the likes and an integer for the fiveStar.  For example, to \"like\" a file the following body would be used:  ```JSON   {     \"id\": \"likes\",     \"myRating\": true   } ``` 
    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 rating
        api_response = api_instance.create_rating(node_id, rating_body_create, fields=fields)
        print("The response of RatingsApi->create_rating:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling RatingsApi->create_rating: %s\n" % e)

Parameters

Name Type Description Notes
node_id str The identifier of a node.
rating_body_create RatingBody For "myRating" the type is specific to the rating scheme, boolean for the likes and an integer for the fiveStar. For example, to "like" a file the following body would be used: ```JSON { "id": "likes", "myRating": true } ```
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

RatingEntry

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: ratingBodyCreate is invalid -
401 Authentication failed -
404 nodeId does not exist -
405 Cannot rate a node of this type -
0 Unexpected error -

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

delete_rating

delete_rating(node_id, rating_id)

Delete a rating

Deletes rating ratingId 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.RatingsApi(api_client)
    node_id = 'node_id_example' # str | The identifier of a node.
    rating_id = 'rating_id_example' # str | The identifier of a rating.

    try:
        # Delete a rating
        api_instance.delete_rating(node_id, rating_id)
    except Exception as e:
        print("Exception when calling RatingsApi->delete_rating: %s\n" % e)

Parameters

Name Type Description Notes
node_id str The identifier of a node.
rating_id str The identifier of a rating.

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 -
400 Invalid parameter: unknown rating scheme specified -
401 Authentication failed -
404 nodeId does not exist -
0 Unexpected error -

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

get_rating

RatingEntry get_rating(node_id, rating_id, fields=fields)

Get a rating

Get the specific rating ratingId on node nodeId.

Example

  • Basic Authentication (basicAuth):
import time
import os
import alfresco_core_api_client
from alfresco_core_api_client.models.rating_entry import RatingEntry
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.RatingsApi(api_client)
    node_id = 'node_id_example' # str | The identifier of a node.
    rating_id = 'rating_id_example' # str | The identifier of a rating.
    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:
        # Get a rating
        api_response = api_instance.get_rating(node_id, rating_id, fields=fields)
        print("The response of RatingsApi->get_rating:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling RatingsApi->get_rating: %s\n" % e)

Parameters

Name Type Description Notes
node_id str The identifier of a node.
rating_id str The identifier of a rating.
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

RatingEntry

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: unknown rating scheme specified -
401 Authentication failed -
404 nodeId does not exist -
0 Unexpected error -

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

list_ratings

RatingPaging list_ratings(node_id, skip_count=skip_count, max_items=max_items, fields=fields)

List ratings

Gets a list of ratings for node nodeId.

Example

  • Basic Authentication (basicAuth):
import time
import os
import alfresco_core_api_client
from alfresco_core_api_client.models.rating_paging import RatingPaging
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.RatingsApi(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 ratings
        api_response = api_instance.list_ratings(node_id, skip_count=skip_count, max_items=max_items, fields=fields)
        print("The response of RatingsApi->list_ratings:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling RatingsApi->list_ratings: %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

RatingPaging

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: value of maxItems or skipCount is invalid -
401 Authentication failed -
404 nodeId does not exist -
0 Unexpected error -

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