Skip Navigation
Expand
Knowledge Advanced analytics for Search REST API questions
Answer ID 10387   |   Last Review Date 01/16/2020

Why do my search questions from the Knowledge Advanced Search REST API not show up in the analytics database tables?

Environment:

Oracle B2C Service Knowledge Advanced
Search REST API

Issue:

The application I am building uses the Search REST API and performs authentication and session initialization to retrieve an integrationUserToken and session respectively. The questions that are asked via the Search REST API endpoints /search/question or /contactDeflection/question are not available in the okcs_stg_question, okcs_stg_annotation or okcs_stg_answers tables. The value of knowledgeInteractionId populates the session_ref colum in the okcs_stg_question and okcs_stg_annotation tables and the okcs_session_ref column in the okcs_stg_answers table.

Resolution:

Knowledge Advanced searches can be performed from anywhere using the Search REST API and are available in the analytics tables when the following is included in the request to the /question endpoint.

The full request must contain:

  • Headers
    • accept: application/json or application/xml
    • content-type: application/json or application/xml
    • kmauthtoken:{"siteName":"<sitename>","interfaceId":"1","localeId":"en-US","knowledgeInteractionId":"<value for session_ref>","integrationUserToken":"<token>"}
  • Body
    • {"session":"<session from initial endpoint>","locale":"en-US","resultLocales":"en-US"}
    • (or appropriate XML)
  • Example endpoint: https://<vhost for site>-qp.custhelp.com/srt/api/latest/contactDeflection/question?startOverFlag=true&question=<your question>
Notes:

For further information on the Search REST API
Knowledge Advanced Search REST API Endpoints
Knowledge Advanced REST API Authenticate and Authorize

Generally, begin with the request elements listed as required in the documentation and beyond that only add elements specific to your application needs.

The interfaceId should be the ID of the interface on which you wish to search, not necessarily 1.

Use of the initialScreen endpoint for one-time session initiation is recommended as a best practice. Those sessions should not be reused between different users, such as those who are not logged in. Rather than using initialScreen, you could generate a search session by not supplying one in a call to the search/question endpoint and retain it for subsequent requests. However, the transactionId will always be 0 unless it is supplied in the body by the client in that same initial call. Hence, initialScreen is recommended as a best practice -- another benefit being that it has no required body parameters. The empty JSON string {} works for initialScreen.

When using navigation or pagination, you should always pass priorTransactionId as a query parameter and supply a different transactionId in each request body (e.g. incremented from the priorTransactionId).

Available Languages for this Answer:

Notify Me
The page will refresh upon submission. Any pending input will be lost.