Enabling search of knowledge document using SOAP / REST

Experts,

We are thinking to have a 'search knowledge' bar to be created on one of employees common page . This would help to search the knowledge documents without having the users login to HP SM ESS / SRC portal. 

Which is the table (kmquery ??) we need to expose to have the search action done on knowledge libraries ? Is it even possible to build a solution like this ?

thx

dev

Tags:

  • Hi,

    there are two extaccess definitions for the table kmdocument.

    I tested it via REST with:

    GET: localhost:13080/.../KM0012

    The response is:

    {
       "Knowledge":    {
          "author": "falcon",
          "categories": ["KM004T:KM006T"],
          "category": "reference",
          "creationdate": "2006-05-10T02:03:11 00:00",
          "doctype": "reference",
          "hotnews": false,
          "id": "KM0012",
          "id.alias": "KM0012",
          "locale": "en",
          "reference": "<div style=\"MARGIN: 0in 0in 0pt\"><strong>The description.....",
          "status": "internal",
          "summary": "affirmative action and equal opportunity rights for all people",
          "title": "Affirmative Action and Equal Employment Opportunity"
       },
       "Messages": [],
       "ReturnCode": 0
    }

    Hope that helps :)

     

  • To search for a field, you can run the following GET Request:

    "&view=expand">localhost:13080/.../knowledges

    My example query is:

    title#"Affirmative"

    Encoded via: https://www.urlencoder.org/

    The result is:

    {
    "@count": 1,
    "@start": 1,
    "@totalcount": 1,
    "Messages": [],
    "ResourceName": "Knowledge",
    "ReturnCode": 0,
    "content": [{"Knowledge": {
    "author": "falcon",
    "categories": ["KM004T:KM006T"],
    "category": "reference",
    "creationdate": "2006-05-10T02:03:11 00:00",
    "doctype": "reference",
    "hotnews": false,
    "id": "KM0012",
    "id.alias": "KM0012",
    "locale": "en",
    "reference": "<htmlcontent>",
    "status": "internal",
    "summary": "affirmative action and equal opportunity rights for all people",
    "title": "Affirmative Action and Equal Employment Opportunity"
    }}]
    }

    See also:

    https://docs.software.hpe.com/SM/9.52/Codeless/Content/webservicesguide/rest_queries.htm

     

  • To use the like search, use can use this:

    /SM/9/rest/knowledges?query=title#"*action*"&view=expand

    The encoded query is:

    title#"*action*"

    The result is something like this:

    {
       "@count": 3,
       "@start": 1,
       "@totalcount": 3,
       "Messages": [],
       "ResourceName": "Knowledge",
       "ReturnCode": 0,
       "content":    [
          {"Knowledge":       {
             "author": "falcon",
             "categories": ["KM004T:KM006T"],
             "category": "reference",
             "creationdate": "2006-05-10T02:03:11 00:00",
             "doctype": "reference",
             "hotnews": false,
             "id": "KM0012",
             "id.alias": "KM0012",
             "locale": "en",
             "reference": "<htmlcontent>",
             "status": "internal",
             "summary": "affirmative action and equal opportunity rights for all people",
             "title": "Affirmative Action and Equal Employment Opportunity"
          }},
          {"Knowledge":       {
             "categories": ["KM012T:KM016T:KM017T"],
             "category": "probsol",
             "creationdate": "2013-12-25T10:05:00 00:00",
             "doctype": "probsol",
             "expirationdate": "2014-12-25T10:05:00 00:00",
             "hotnews": false,
             "id": "KM0194",
             "id.alias": "KM0194",
             "legacyid": "K052220130069553",
             "locale": "en",
             "problem": "If Excel is waiting for another application to complete an OLE action in MS Excel 2010",
             "solution": "<htmlontent>",
             "status": "external",
             "summary": "If Excel is waiting for another application to complete an OLE action in MS Excel 2010",
             "title": "EXCEL WAITING FOR ANOTHER APP TO COMPLETE OLE ACTION"
          }},
          {"Knowledge":       {
             "answer": "<htmlcontent>",
             "categories": ["KM012T:KM013T:KM018T"],
             "category": "howto",
             "creationdate": "2013-12-25T10:11:43 00:00",
             "doctype": "howto",
             "expirationdate": "2014-12-25T10:11:42 00:00",
             "hotnews": false,
             "id": "KM0286",
             "id.alias": "KM0286",
             "legacyid": "K020220130069055",
             "locale": "en",
             "question": "How to change the Action Center settings in MS Windows 7.",
             "status": "external",
             "summary": "How to change the Action Center settings in MS Windows 7.",
             "title": "CHANGE THE ACTION CENTER SETTINGS"
          }}
       ]
    }

    As you can see, based on the KM type/category, you have different response fields.

  • Hi Experts,

    Thank you for the reply.. Kudos to you.

    Question:

    If I enable the search from another web site, the license consumption would be based on the number of web servers from whcih the requests comes to HP SM ?. So if I say, I have 3 web servers which loadbalances the web site, then any number of searches would consume 3 licenses, right ??

  • Good morning,

    that's a good question.

    If I'm not wrong, the HPSM checks if the current user is already logged in.
    If so, then only one license will be used. 

    But you can test it easily.

    Before sending the first request to the HPSM, check via the CLI how many licenses you have.
    The command is

    sm -reportlic


    Then send some requests and check the license again.

    Check also the log file, there should be something like:

      3772(  4892) 09/21/2017 09:43:49  RTE I User falcon logged in.  Already licensed
      3772(  4892) 09/21/2017 09:43:49  RTE I User falcon has logged in and is using a Floating license ( 2 out of a maximum XXX)

    But this message is shown only, if you're using the same client again.

    I tested it with:

    • login inside the VM: 1 licensed used
    • login from the VM Host: 1 licensed used
    • second login from the VM host: no licensed used --> log message from above

     

     

     

    Documentation: