Find article by answer ID

get

/km/api/v1/content/articles/{answerId}

This method returns an article business object that matches the specified answer ID. It optionally returns the content schema for the record and all its rating responses.

The answerId in the URI is a unique ID that enables Oracle Engagement Cloud to map Service Cloud answers with the content record in the Oracle Knowledge repository. Answer ID can be a long or integer value and is unique for a specific content ID and locale ID.

Please note that while the modes KEY, DATA, EXTENDED, and FULL may be specified as part of the request, this does not affect the data returned.

Request Content with Conditional Attributes

To request a document with conditional attributes, you can use the additionalFields request parameter. This parameter takes a comma separated list of lowercased field names that will be added to the document. The field names can be specified in any order.

The complete list of field names is listed below:

  • contentschema - the document's translated content schema
  • aggregateformresults - the AggregateFormResults object that represents all the article's rating responses (e.g. total responses, average rating)

For example, to retrieve the content schema field, additionalFields can be specified as additionalFields=contentschema. To retrieve both the content schema and aggregate form results, additionalFields can be specified as additionalFields=contentschema,aggregateformresults.

If the value of a field cannot be obtained or if there is an error that occurs while obtaining the value, then the return value of the field will be blank. If the rating type is configured as no rating, then an AggregrateFormResults object is not returned.

Request Content Access Events Recording

You can record content access events to categorize activities done by the end user. You can view the recorded content access events in a custom Oracle Engagement Cloud Analytics report.

To enable recording on the content access events, you must specify the following parameters in the HTTP request:

  • Specify recordContentViewEvent request parameter with the HTTP request, and set the parameter value as true.
  • Specify the mode of the Content object as EXTENDED or FULL.
  • Specify the isForEdit request parameter with the HTTP request, and set the parameter value as false. The default value is false.

For example, when the request is submitted using the URI http://<IM_REST_API_HOST>/km/api/content/answers/{id}/article?mode=FULL&activityType=SomeActivity, you get a read only Content object in the FULL mode in the default locale. An analytics content access event is recorded with SomeActivity as the activity type.

To turn off the analytic content access event recording, you must set the recordContentViewEvent request parameter value as false.

The following table describes the request parameters to manage analytics on content.

Parameter Behavior
recordContentViewEvent

The parameter turns the recording of content access events on or off. The values of the parameter are true or false. If the parameter value is set to true, then the service records the information regarding the content access.

If the parameter is not used with the HTTP request, then by default the value is considered as true.

activityType

The parameter specifies the type of access associated with the specific content access event. The parameter accepts any string value. It is used to categorize content access events to provide detailed information in the custom Oracle Knowledge Analytics report.

If the parameter is not used with the HTTP request, then by default the value is considered as null.

Request Translated Content

You cannot request translated content using version ID or answer ID.

Version ID represents a specific translation of the content in the major and minor versions. For example, a document FA54 has two different version IDs for English content, one at version 1.0 and the other at 2.0.

Answer ID represents a specific translation of the content. For example, a document FA54 has answer ID 101 for English and answer ID 102 for Spanish.

Content Security

The service uses the security role permissions assigned to the user to display the content. A web user can access the content in the following conditions:

  • User must have view privilege on the content type in which the specified content record is saved.
  • The UserGroup objects assigned to the user must match with at least one of the UserGroup objects assigned to the content.
  • The views assigned to the user match with at least one of the views assigned to the content.

Response Errors

The possible error responses for this method are as follows:

  • OK-GEN0020

    The error occurs when the isForEdit or agentMode request parameter values is set as true.

  • OKDOM-GEN0001

    The error occurs when a content with the specified answer ID cannot be found.

  • $ERROR.General.BO_MODE_NOT_FOUND_CODE$

    The error occurs when an invalid mode is specified with the request. The valid mode values are KEY, DATA, EXTENDED, and FULL.

  • OKDOM-GEN0006

    The error occurs when you specify any invalid value with the contentState parameter in the HTTP service request.

    The valid values for contentState parameter are: PUBLISHED, LATEST, and LATESTVALID.

  • OKDOM-CONT0121

    The error occurs when you specify LATEST as the contentState value along with the HTTP Service request.

    The content resource does not allow the LATEST as contentState parameter value.

Example URIs

The example URIs for this method are as follows:

  • http://<IM_REST_API_HOST>/km/api/content/answers/{id}/article

    The request returns an Article object having the specified answer ID parameter. By default, the published version of the content appears in the default locale.

  • http://<IM_REST_API_HOST>/km/api/content/answers/{id}/article?additionalFields=contentschema,aggregateformresults

    The request returns an Article object having the specified answer ID parameter. The Article object also contains the content schema and the AggregateFormResults object that represents all the Article's rating responses.

  • http://<IM_REST_API_HOST>/km/api/content/answers/{id}/article?additionalFields=aggregateformresults

    The request returns the aggregate questions and answers of a rating for the Article object with the specified ID parameter. The aggregate rating returned can be a Five-Star rating, Like and Dislike rating or no rating.

Request

Path Parameters
Back to Top

Response

Supported Media Types

200 Response

OK.
Body ()
Root Schema : Article
Type: object
Title: Article
Show Source
Nested Schema : AggregateFormResults
Type: object
Title: AggregateFormResults
Show Source
Nested Schema : Schema
Type: object
Title: Schema
Show Source
Nested Schema : ContentTypeKey
Type: object
Title: ContentTypeKey
Show Source
Nested Schema : UserKey
Type: object
Title: UserKey
Show Source
Nested Schema : links
Type: array
Show Source
Nested Schema : LocaleKey
Type: object
Title: LocaleKey
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
Nested Schema : schemaAttributes
Type: array
List of schema attributes for the schema
Show Source
Nested Schema : SchemaAttribute
Type: object
Title: SchemaAttribute
Show Source
Nested Schema : children
Type: array
List of child nodes of the current element
Show Source
Nested Schema : localizedAttributes
Type: array
List of LocalizedAttributes of this SchemaAttribute name and description in various Locales
Show Source
Nested Schema : schemaAttributeUserGroupList
Type: array
List of user groups that can be used to secure this attribute. This should be a subset of the list of user groups assigned to the ContentType
Show Source
Nested Schema : LocalizedAttributes
Type: object
Title: LocalizedAttributes
Show Source
Nested Schema : SchemaAttributeUserGroup
Type: object
Title: SchemaAttributeUserGroup
Show Source
Nested Schema : UserGroupKey
Type: object
Title: UserGroupKey
Show Source
Back to Top

Examples

The following example shows how to find a Content object that has the specified answer ID by submitting a get request on the REST resource using cURL.

curl -X GET "https://<IM_REST_API_HOST>/km/api/latest/content/articles/{answerId}" -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:

{
    "isForEdit": false,
    "categories": [
        {
            "recordId": "FDCF1C34F45A48669D651CE553398AC1",
            "referenceKey": "FUSION_PRODUCT_999994000663240",
            "objectId": "017.001.002.004.003",
            "name": "NAME_VALUE",
            "externalId": 999994000663240,
            "externalType": "PRODUCT",
            "links": [
                {
                    "rel": "canonical",
                    "href": "http://IM_REST_API_HOST/km/api/latest/categories/FDCF1C34F45A48669D651CE553398AC1",
                    "mediaType": "application/json, application/xml",
                    "method": "GET"
                }
            ]
        }
    ],
    "userGroups": [],
    "views": [
        {
            "recordId": "C3643883234B4B319793840918246A31",
            "referenceKey": "TENANT",
            "name": "fusion_fuscdrmsmc84",
            "links": [
                {
                    "rel": "canonical",
                    "href": "http://IM_REST_API_HOST/km/api/latest/views/C3643883234B4B319793840918246A31",
                    "mediaType": "application/json, application/xml",
                    "method": "GET"
                }
            ]
        }
    ],
    "recordId": "04003603ae8b6fa015b67b70ab2007fed",
    "versionId": "040087c2c9880015b887da26f007feb",
    "documentId": "SOL5",
    "title": "kcz - test solution - one prod 1",
    "version": "2.0",
    "answerId": 1000840,
    "locale": {
        "recordId": "en_US",
        "links": [
            {
                "rel": "canonical",
                "href": "http://IM_REST_API_HOST/km/api/latest/locales/en_US",
                "mediaType": "application/json, application/xml",
                "method": "GET"
            }
        ]
    },
    "dateModified": "2017-04-19T18:04:57-0600",
    "links": [
        {
            "rel": "canonical",
            "href": "http://IM_REST_API_HOST/km/api/latest/content/04003603ae8b6fa015b67b70ab2007fed",
            "mediaType": "application/json, application/xml",
            "method": "GET"
        },
        {
            "rel": "collection",
            "href": "http://IM_REST_API_HOST/km/api/latest/content",
            "mediaType": "application/json, application/xml",
            "method": "GET",
            "profile": "http://IM_REST_API_HOST/km/api/latest/metadata-catalog/content"
        }
    ],
    "contentType": {
        "recordId": "C6FAA0D5AFF442C2BED0EED8D8EDD9C0",
        "referenceKey": "SOLUTION",
        "name": "Solution",
        "links": [
            {
                "rel": "canonical",
                "href": "http://IM_REST_API_HOST/km/api/latest/contentTypes/C6FAA0D5AFF442C2BED0EED8D8EDD9C0",
                "mediaType": "application/json, application/xml",
                "method": "GET"
            }
        ]
    },
    "priority": "PRIORITY_0",
    "createDate": "2017-04-18T11:26:20-0600",
    "dateAdded": "2017-04-19T18:04:57-0600",
    "displayStartDate": "2017-04-18T11:24:56-0600",
    "displayEndDate": "9999-12-31T00:00:00-0700",
    "owner": {
        "recordId": "0400876c97c918015af96da5cc007f1c",
        "name": "kmtest1 svc",
        "externalType": "ACCOUNT",
        "links": [
            {
                "rel": "canonical",
                "href": "http://IM_REST_API_HOST/km/api/latest/users/0400876c97c918015af96da5cc007f1c",
                "mediaType": "application/json, application/xml",
                "method": "GET"
            }
        ]
    },
    "lastModifier": {
        "recordId": "0400876c97c918015af96da5cc007f1c",
        "name": "kmtest1 svc",
        "externalType": "ACCOUNT",
        "links": [
            {
                "rel": "canonical",
                "href": "http://IM_REST_API_HOST/km/api/latest/users/0400876c97c918015af96da5cc007f1c",
                "mediaType": "application/json, application/xml",
                "method": "GET"
            }
        ]
    },
    "creator": {
        "recordId": "0400876c97c918015af96da5cc007f1c",
        "name": "kmtest1 svc",
        "externalType": "ACCOUNT",
        "links": [
            {
                "rel": "canonical",
                "href": "http://IM_REST_API_HOST/km/api/latest/users/0400876c97c918015af96da5cc007f1c",
                "mediaType": "application/json, application/xml",
                "method": "GET"
            }
        ]
    },
    "published": true,
    "pending": false,
    "publishDate": "2017-04-19T18:04:57-0600",
    "checkedOut": false,
    "publishedVersion": "2.0",
    "xml": "<SOLUTION><SUMMARY><![CDATA[kcz - test solution - one prod 1]]></SUMMARY><ISSUE><![CDATA[kcz - test solution]]></ISSUE><RESOLUTION><![CDATA[kcz - test solution]]></RESOLUTION></SOLUTION>",
    "resourcePath": "http://IM_REST_API_HOST/content/draft/04003603ae8b6fa015b67b70ab2007fed/040087c2c9880015b887da26f007feb/"
}
Back to Top