Get suggested articles

get

/km/api/v1/suggestedSearch

This method returns the list of suggested article objects based on the specified search-keywords. The article titles are returned only when the titles contain the search keywords either partially or completely.

NOte:Before using the suggested search resource, ensure that attribute level searching for the master identifier of the content-type is enabled and to run reindex on conten-types. For more information, see Knowledge Advanced Administration Guide.

When you send a GET request for the suggested search resource, you must specify query parameter (q) in the request.

Example URIs

The example URIs for this method are as follows:

  • http:///api/latest/suggestedSearch?q=cloud

    The request returns a list of suggested article objects that have the word 'cloud' in the titles.

  • http:///api/latest/suggestedSearch?q=cloud&contentState=PUBLISHED

    The request returns a list of suggested article objects which are published and which contain the word 'cloud' in the titles.

  • http:///api/latest/suggestedSearch?q=cloud&limit=10

    The request returns a list of maximum of 10 suggested article objects which contain the word 'cloud' in the titles.

Query Parameters

The following table describes the query parameters for this resource.

Parameter Description
q

Input query text

applyCTIndexStatus

Optional flag that sets the status filter same as the document status for indexing by Oracle Knowledge Search, defined on the content type.

limit

Number of suggestions to be received in response. This is optional.

categories

Comma separated product or category reference keys to be applied to filter the suggestions. This is optional.

matchAllCategories

Optional flag that specifies to return article title as suggestion that are associated with all the product or category reference keys sent in the request parameter 'categories'. This parameter is ignored if the parameter 'categories' is not sent in the request. If this parameter is not specified or if the value is false, then article titles associated with any of the product or category reference keys specified for 'categories' will be returned as suggestions.

Article Locale

When you send a request, you can specify the target locale of an article in one of the following ways.

  • Specify the required locale code in the Accept-Language header. Example: Accept-Language: en-US
  • Specify the langpref request parameter and its value within the HTTP request. Example: GET http:///km/api/latest/suggestedSearch?langpref=es_ES
  • Specify the localeId attribute and its value in the kmauthoken. Example: kmauthtoken: {siteName:example_site_name, locale:es_ES}

    The locale value of an article is specified in the following ways:
  • When Accept-Language header, langpref parameter, and localeID values are specified in a single request, Accept-Language header value takes precedence.
  • When a value is not specified for the Accept-Language header, then langpref value is considered.
  • When a value is not specified for the Accept-Language header, then langpref value is considered.
  • When a value is not specified for both Accept-Language header and langpref parameter, only then the value of localeId attribute is considered

Interface ID

When using the suggested search resource, you can request an article which is associated with a specified Oracle B2C Service interface. For example, the following request retrieves the article from the Customer Portal that has the interface ID value of 3.

GET http:///api/latest/suggestedSearch?interfaceId=3

The locale of an article is determined by the Oracle B2C Service interface mapping to the Knowledge Advanced view and locale. For more information, see Knowledge Advanced user documentation.

NOTE: If the kmauthtoken header contains an Interface ID value, then the service returns only documents that are mapped to the specified interface.

Response Errors

The possible error responses for this method are as follows:

  • OKDOM-LUC0001

    The error occurs when the requested index of the content is corrupted.

  • OKDOM-LUC0004

    The error occurs when the queried content could not be found.

  • OK-GEN0001

    The error occurs when query parameter (q) is not specified in the request or when no value is specified for the parameter q.

  • Request

    There are no request parameters for this operation.

    Back to Top

    Response

    Supported Media Types

    200 Response

    OK.
    Body ()
    Root Schema : ResultList SuggestedArticle
    Type: object
    Title: ResultList SuggestedArticle
    Match All
    Show Source
    Nested Schema : Collection Paging Resource
    Title: Collection Paging Resource
    Oracle base collection resource schema definition.
    Match All
    Show Source
    Nested Schema : Base Collection Resource
    Title: Base Collection Resource
    Oracle base collection resource schema definition.
    Match All
    Show Source
    Nested Schema : Singular Resource
    Type: object
    Title: Singular Resource
    Oracle base singular resource schema definition.
    Show Source
    Nested Schema : Base Collection Resource-allOf[1]
    Type: object
    Show Source
    Nested Schema : Collection Paging Resource-allOf[1]
    Type: object
    Show Source
    Nested Schema : ResultList SuggestedArticle-allOf[1]
    Type: object
    Show Source
    Nested Schema : items
    Type: array
    Show Source
    Nested Schema : items
    Type: object
    Nested Schema : items
    Type: array
    Show Source
    Nested Schema : SuggestedArticle
    Match All
    Show Source
    Nested Schema : ContentKey
    Match All
    Show Source
    Nested Schema : ContentKey-allOf[1]
    Type: object
    Show Source
    Nested Schema : SuggestedArticle-allOf[1]
    Type: object
    Show Source
    Nested Schema : allTranslations
    Type: array

    This field will return list of all translated content that the user can view

    This field will only be populated if allTranslations query parameter is passed in with value true.

    Show Source
    Nested Schema : LocaleKey
    Match All
    Show Source
    Nested Schema : LocaleKey-allOf[1]
    Type: object
    Show Source
    Back to Top