Find article by answer ID
/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
-
answerId: integer
Answer ID that uniquely identifies an article
Response
- application/json
- application/xml
200 Response
object
Article
-
aggregateFormResults(optional):
object AggregateFormResults
Title:
AggregateFormResults
-
answerId(optional):
integer
The unique identifier of the content.
-
contentSchema(optional):
object Schema
Title:
Schema
-
contentType(optional):
object ContentTypeKey
Title:
ContentTypeKey
-
createDate(optional):
string(date-time)
The date when the content was created. For legacy systems, the create date is the date when the document was created in those systems.
-
creator(optional):
object UserKey
Title:
UserKey
-
dateAdded(optional):
string(date-time)
The date when the content was added to the content type. For legacy systems, the date added is the date when the document was migrated from the legacy system to the Oracle Knowledge Repository.
-
dateModified(optional):
string(date-time)
The date when the content was last modified in the Oracle Knowledge Repository.
-
displayEndDate(optional):
string(date-time)
The date when the service stops the display of the document to the end users.
-
displayStartDate(optional):
string(date-time)
The date when the document will be available to display to end-users.
-
documentId(optional):
string
The non-unique identifier of the content. This identifier indicates the content type in which the content is saved.
-
lastModifiedDate(optional):
string(date-time)
The date when the content was last modified. For legacy systems, the last modified date is the date when the document was last modified in those systems.
-
lastModifier(optional):
object UserKey
Title:
UserKey
-
links(optional):
array links
-
locale(optional):
object LocaleKey
Title:
LocaleKey
-
owner(optional):
object UserKey
Title:
UserKey
-
publishDate(optional):
string(date-time)
The date when the document was first displayed to end users.
-
published(optional):
boolean
The flag that indicates whether the document is published.
-
publishedVersion(optional):
string
The published version of the document.
-
recordId(optional):
string
The unique identifier of the document. This ID is same in all versions in all locales of the document.
-
title(optional):
string
The title of the document.
-
version(optional):
string
The version of the document.
-
versionId(optional):
string
The unique identifier of the specific version of a document in a specific locale. You cannot use this field in queries made using the
q
query parameter. -
xml(optional):
string
The XML of the document. This contains the content of the document and the content schema reference keys.
object
AggregateFormResults
-
links(optional):
array links
-
questions(optional):
array questions
To Many Relationship to AggregateQuestionResult
-
recordId(optional):
string
The unique record ID of the AggregateFormResults object.
-
referenceKey(optional):
string
The reference key for the AggregateFormResults object. AggregateFormResults objects support multiple languages. This field can be used to identify the associated objects for all languages.
-
totalResponses(optional):
integer
TotalResponses of the AggregateFormResults object
object
Schema
-
dateAdded(optional):
string(date-time)
Timestamp when the schema was added
-
dateModified(optional):
string(date-time)
Timestamp when the schema was last modified
-
links(optional):
array links
-
recordId(optional):
string
unique identfier of the schema object.
-
schemaAttributes(optional):
array schemaAttributes
List of schema attributes for the schema
object
ContentTypeKey
-
description(optional):
string
The description for the ContentType object. Content Types support multiple languages.
This field identifies the object associated with the language specified by the user.
-
links(optional):
array links
-
name(optional):
string
The name for the ContentType object. The name field can only be used for sorting.
Content Types support multiple languages. This field identifies the object associated with the language specified by the user.
-
recordId(optional):
string
The unique identifier of the ContentType object.
-
referenceKey(optional):
string
The reference key for the ContentType object.
ContentType objects support multiple languages. This field can be used to identify the associated objects for all languages.
-
stripeCd(optional):
string
Lookup code that indicates the stripe code.
object
UserKey
-
email(optional):
string
Email of the User object
-
externalId(optional):
integer
The ExternalId is the Id of the corresponding User from an external system. It, along with ExternalType, can be used to bridge the gap between a User from this system and a User from an external system.
-
externalType(optional):
string
The ExternalType is the type of the corresponding User from an external system. It, along with ExternalId, can be used to bridge the gap between a User from this system and a User from an external system.
-
links(optional):
array links
-
name(optional):
string
User's full name
-
recordId(optional):
string
The unique record ID of the User object.
array
-
Array of:
object instanceLink
Metadata describing link description objects that MAY appear in the JSON instance representation.
object
LocaleKey
-
links(optional):
array links
-
recordId(optional):
string
The unique identifier of the Locale object.
array
-
Array of:
object instanceLink
Metadata describing link description objects that MAY appear in the JSON instance representation.
array
-
Array of:
object AggregateQuestionResult
Title:
AggregateQuestionResult
object
-
href:
string
URI [RFC3986] or URI Template [RFC6570]. If the value is set to URI Template, then the "templated" property must be set to true.
-
mediaType(optional):
string
Media type, as defined by RFC 2046, describing the link target.
-
method(optional):
string
HTTP method for requesting the target of the link.
-
profile(optional):
string
Link to the metadata of the resource, such as JSON-schema, that describes the resource expected when dereferencing the target resource..
-
rel:
string
Name of the link relation that, in addition to the type property, can be used to retrieve link details. For example, href or profile.
-
templated(optional):
boolean
Boolean flag that specifies that "href" property is a URI or URI Template. If the property is a URI template, set this value to true. By default, this value is false.
object
AggregateQuestionResult
-
answers(optional):
array answers
To Many Relationship to AggregateAnswerResult
-
averageResponse(optional):
number
AverageResponse of the AggregateQuestionResult object
-
name(optional):
string
Localized display name for the Question
-
recordId(optional):
string
The unique record ID of the AggregateQuestionResult object.
-
referenceKey(optional):
string
The reference key for the AggregateQuestionResult object. AggregateQuestionResult objects support multiple languages. This field can be used to identify the associated objects for all languages.
-
totalResponses(optional):
integer
TotalResponses of the AggregateQuestionResult object
array
-
Array of:
object AggregateAnswerResult
Title:
AggregateAnswerResult
object
AggregateAnswerResult
-
name(optional):
string
Localized display name for the Answer
-
recordId(optional):
string
The unique record ID of the AggregateAnswerResult object.
-
referenceKey(optional):
string
The reference key for the AggregateAnswerResult object. AggregateAnswerResult objects support multiple languages. This field can be used to identify the associated objects for all languages.
-
totalResponses(optional):
integer
TotalResponses of the AggregateAnswerResult object
array
-
Array of:
object instanceLink
Metadata describing link description objects that MAY appear in the JSON instance representation.
array
-
Array of:
object SchemaAttribute
Title:
SchemaAttribute
object
SchemaAttribute
-
allowMultipleNodes(optional):
boolean
Flag indicating if multiple nodes are allowed of this type @since 8.3
-
allowPreselectedUserGroupChange(optional):
boolean
Enable editors to modify preselected user group restrictions @since 8.3
-
children(optional):
array children
List of child nodes of the current element
-
counter(optional):
integer
This attribute contains the current value of the ContentType DOC ID counter. This value should not be changed after content is added to the ContentType
-
counterPrefix(optional):
string
This attribute contains the prefix that is appended to the front of the DOC ID counter
-
dateAdded(optional):
string(date-time)
This attribute represents the timestamp when the SchemaAttribute definition was first created
-
dateModified(optional):
string(date-time)
This attribute represents the timestamp when the SchemaAttribute definition was last modified
-
description(optional):
string
Localized help text for the attribute. This text is displayed in the authoring view
-
enableAttributeLevelSearch(optional):
boolean
Flag indicating whether this field should be configured for attribute level searching - i.e. where TITLE='xyz'. This field was previously called searchable @since 8.3
-
enableFullTextSearch(optional):
boolean
Flag indicating whether this field should be included in the full text index. This field was previously called indexable @since 8.3
-
includeInMasterIdentifier(optional):
boolean
Flag indicating whether this field should be appended to the master identifier of the document
-
isNode(optional):
boolean
Flag indicating if this element is a node @since 8.3
-
isRequired(optional):
boolean
Make attribute a required field @since 8.3
-
links(optional):
array links
-
localizedAttributes(optional):
array localizedAttributes
List of LocalizedAttributes of this SchemaAttribute name and description in various Locales
-
name(optional):
string
Localized name of the attribute. This need NOT be unique within the Schema.
-
readOnly(optional):
boolean
Flag indicating whether this field is editable
-
recordId(optional):
string
Unique identifier for the SchemaAttribute object
-
referenceKey(optional):
string
Non localized name of the attribute. SchemaAttribute's referenceKey need NOT be unique within its Schema. But its xpath will be unique within its Schema.
-
requireWorkflowApproval(optional):
boolean
Attribute requires workflow approval if workflow is enabled
-
schemaAttributeUserGroupList(optional):
array schemaAttributeUserGroupList
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
-
schemaAttrType(optional):
Allowed Values:
[ "TEXT_AREA", "WYSIWYG_EDIT", "TEXT_FIELD", "FILE", "BOOLEAN", "LIST", "COUNTER", "DATE", "DATETIME", "TIME", "INTEGER", "FLOAT" ]
Enumerated type representing the type of attribute - i.e. text field, rich text area -
securedFileResource(optional):
boolean
Flag indicating if this attribute (file types only) should be marked as secure - i.e. stored in the ~secure folder near the content XML file
-
secureWithUserGroups(optional):
boolean
Restrict attribute to selected user groups
-
securityRegex(optional):
string
The regular expression used to validate the field against security attacks.
-
sortOrder(optional):
integer
Display order of the schema attributes within the edit form
-
textHeight(optional):
string
Specifies the text height for text areas and rich text fields
-
textWidth(optional):
string
Specifies the max length for text fields
-
userGroupSelectionRequired(optional):
boolean
User groups are required for attribute
-
wysiwygType(optional):
Allowed Values:
[ "BASIC", "MEDIUM", "FULL" ]
Type of WYSIWYG rich text field - i.e. FULL, BASIC, MEDIUM @since 8.3 -
xpath(optional):
string
The XPATH of this attribute within the schema. This is unique within the Schema.
array
-
Array of:
object SchemaAttribute
Title:
SchemaAttribute
array
-
Array of:
object instanceLink
Metadata describing link description objects that MAY appear in the JSON instance representation.
array
-
Array of:
object LocalizedAttributes
Title:
LocalizedAttributes
array
-
Array of:
object SchemaAttributeUserGroup
Title:
SchemaAttributeUserGroup
object
LocalizedAttributes
-
description(optional):
string
Localized description in the above Locale
-
localeId(optional):
string
RecordId of the Locale - generally this is the localeCode (like en_US) and NOT a real GUID.
-
name(optional):
string
Localized Name in the above Locale
object
SchemaAttributeUserGroup
-
defaultValue(optional):
boolean
Flag indiacting whether the user group should be selected by default
-
recordId(optional):
string
GUID from the XMLSCHEMAATTRIBUTEUSERGROUP table
-
userGroup(optional):
object UserGroupKey
Title:
UserGroupKey
object
UserGroupKey
-
externalId(optional):
integer
The unique identifier of the corresponding userGroup from an external system. You can use the External ID with the ExternalType parameter to connect user groups in the internal and the the external systems.
-
externalType(optional):
string
The ExternalType is the type of the corresponding userGroup from an external system.
-
links(optional):
array links
-
name(optional):
string
The localized name of the user group. The name field can only be used for sorting.
-
recordId(optional):
string
The unique identifier from the TAG table that represent a userGroups resource
-
referenceKey(optional):
string
The non localized name of the user group
-
stripeCD(optional):
string
Stripe for UserGroup
array
-
Array of:
object instanceLink
Metadata describing link description objects that MAY appear in the JSON instance representation.
array
-
Array of:
object instanceLink
Metadata describing link description objects that MAY appear in the JSON instance representation.
array
-
Array of:
object instanceLink
Metadata describing link description objects that MAY appear in the JSON instance representation.
array
-
Array of:
object instanceLink
Metadata describing link description objects that MAY appear in the JSON instance representation.
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/" }