Skip Navigation
Expand
Searching user restricted articles with Knowledge Advanced Search REST API
Answer ID 10508   |   Last Review Date 07/24/2019

Why do my search results not contain articles restricted to certain user groups?

Environment:

Oracle B2C Service Knowledge Advanced
Search REST API

Issue:

The Knowledge Advanced integration I am building with the Search REST API needs to search articles that are not public, but restricted to certain user groups. The integration performs authentication and session initialization to retrieve an integrationUserToken and session respectively.  The /question endpoint is used for a search but no articles associated with a specific user group are returned.

Resolution:

There is a second optional authorization endpoint for the Search REST API that is available for use to get a userToken.  This is the /km/api/latest/auth/authorize endpoint and can be used to get a userToken for a Console User (userExternalType=ACCOUNT) or Web User (userExternalType=CONTACT).  This token is added to the kmauthtoken and passed to subsequent requests for the /question endpoint. Conducting a full session by authenticating the API User, authenticating a Console or Web User, creating a session, and asking a question will enable your integration to correctly view user group restricted content.  The full request to the /question endpoint must contain:
  • Headers
    • accept: application/json
    • content-type: application/json
    • kmauthtoken:{"siteName":"<sitename>","interfaceId":"1","localeId":"en-US","knowledgeInteractionId":"<value for session_ref>","integrationUserToken":"<token from /km/api/latest/auth/integration/authorize>","userToken":"<token from /km/api/latest/auth/authorize>"}
  • Body
    • {"session":"<session from /Initial endpoint>","transactionId":<integer>,"locale":"en-US","resultLocales":"en-US"}
  • Endpoint: https://<vhost for site>-qp.custhelp.com/srt/api/latest/search/question%3Fquestion%3D<search terms>
Notes:
For further information on the Search REST API