Get aggregate rating result

get

/km/api/v1/content/{id}/ratingsAggregate

This method returns the AggregateFormResults object that represents all the rating responses for the specified Content translation. The AggregateFormResults object includes the rating's questions and rating's answers displayed in the Locale specified with the request.

You can specify the Locale by setting the localeId parameter of the kmauthtoken header when making requests to the Oracle Engagement Cloud Knowledge REST APIs. Alternatively, if no localeId parameter value is specified, then the method interprets the specified Locale as the default Locale object assigned to the logged-in user.

In both the cases, the specified Locale is referred to as the session's locale. The userToken attribute on the kmauthtoken header is created for the logged-in user. Additionally, the Locale can be specified by the langpref request parameter.

The method sums the response for each question and calculates the average rating for the Content object based on the ratings type for the specified Locale. Rating types other than the Five-Star rating have zero as the value of the average rating.

There are three types of ratings:

  • Five-Star rating ??? A row of five star icons appear at the end of the article. Each star icon represents the level of quality.
  • Like and dislike - Thumbs-up symbol represents like and thumbs-down symbol represents dislike.
  • No ratings

Note: A Content object can be rated only for a specific Locale. Therefore, the method returns a different AggregateFormResults object for the same Content object when the request is made with different Locale objects.

Example URIs

Following are the example URIs for this method:

  • http://<IM_REST_API_HOST>/km/api/latest/content/{id}/ratingsAggregate

    The request returns an AggregateFormResults object for the specified Content object, translated in the session's locale.

  • http://<IM_REST_API_HOST>/km/api/latest/content/{id}/ratingsAggregate?langpref=es_ES

    The request returns an AggregateFormResults object for the specified Content object, translated in the request's locale.

Response Errors

  • OKDOM-GEN0001

    This error occurs when an invalid ID is specified in the request.

  • OKDOM-SURV0018

    This error occurs when rating type is configured as no rating.

Request

Path Parameters
Back to Top

Response

Supported Media Types

200 Response

OK.
Body ()
Root Schema : AggregateFormResults
Type: object
Title: AggregateFormResults
Show Source
Nested Schema : questions
Type: array
To Many Relationship to AggregateQuestionResult
Show Source
Nested Schema : AggregateQuestionResult
Type: object
Title: AggregateQuestionResult
Show Source
Nested Schema : answers
Type: array
To Many Relationship to AggregateAnswerResult
Show Source
Nested Schema : AggregateAnswerResult
Type: object
Title: AggregateAnswerResult
Show Source
Back to Top

Examples

Example 1

The following example show how to find the aggregate questions and answers of a rating for the specified Content object when the rating type is Five-Star.

curl -X GET "https://<IM_REST_API_HOST>/km/api/latest/content/{id}/ratingsAggregate" -u "<username:password>" -H "Accept: application/json" -H "Content-Type: application/json"

Example of Response Body

The following example shows the contents of the response body in JSON format:

{
    "questions": [
        {
            "answers": [
                {
                    "totalResponses": 2,
                    "recordId": "29C9EEA5CB2B484A94762A4B1517EB57",
                    "referenceKey": "A5",
                    "name": "5"
                },
                {
                    "totalResponses": 1,
                    "recordId": "3A9A0952D3CF4A138FA4518A0F25F020",
                    "referenceKey": "A3",
                    "name": "3"
                },
                {
                    "totalResponses": 0,
                    "recordId": "4EFDA9A45A144CFDA9E0973A04BD5114",
                    "referenceKey": "A2",
                    "name": "2"
                },
                {
                    "totalResponses": 1,
                    "recordId": "6BF001ED4CEB4EF1A007355BEE421F46",
                    "referenceKey": "A4",
                    "name": "4"
                },
                {
                    "totalResponses": 0,
                    "recordId": "FC0EBC5507A041029D0FFE62A7DEAA6A",
                    "referenceKey": "A1",
                    "name": "1"
                }
            ],
            "recordId": "D56585C3385846B5A8D700593E1C96F4",
            "referenceKey": "Q1",
            "name": "How would you rate this document?",
            "totalResponses": 4,
            "averageResponse": 4.25
        }
    ],
    "recordId": "EBA5CB446E25451C994D881F60FDA0BD",
    "referenceKey": "5_STAR_RATING",
    "links": [
        {
            "rel": "canonical",
            "href": "https://<IM_REST_API_HOST>/km/api/latest/content/<content ID>/ratingsAggregate",
            "mediaType": "application/json, application/xml",
            "method": "GET"
        }
    ],
    "totalResponses": 4
}

Example 2

The following example shows how to find the aggregate questions and answers of a rating for the specified Content object when the rating type is like and dislike.

curl -X GET "https://<IM_REST_API_HOST>/km/api/latest/content/{id}/ratingsAggregate" -u "<username:password>" -H "Accept: application/json" -H "Content-Type: application/json"

Example of Response Body

The following example shows the contents of the response body in JSON format:

{
    "questions": [
        {
            "answers": [
                {
                    "totalResponses": 2,
                    "recordId": "874CF739B99F4D358050B6C5CCC819F6",
                    "referenceKey": "YES_OR_NO_RATING_A1",
                    "name": "Dislike"
                },
                {
                    "totalResponses": 1,
                    "recordId": "B73836830DC0401FA931120E4634408A",
                    "referenceKey": "YES_OR_NO_RATING_A2",
                    "name": "Like"
                }
            ],
            "recordId": "94AEF5ABE53A4E609EFD0A208E9007C3",
            "referenceKey": "YES_OR_NO_RATING_Q1",
            "name": "Do you like this Article?",
            "totalResponses": 3,
            "averageResponse": 0
        }
    ],
    "recordId": "45C98B085B044881821DE07F68DC14CF",
    "referenceKey": "YES_OR_NO_RATING",
    "links": [
        {
            "rel": "canonical",
            "href": "https://<IM_REST_API_HOST>/km/api/latest/content/<content ID>/ratingsAggregate",
            "mediaType": "application/json, application/xml",
            "method": "GET"
        }
    ],
    "totalResponses": 3
}
Back to Top