Create REST API to retrieve records from SM table

Hi,

How to create SM REST API to retrieve list of records from specific SM DB table. I managed to create a simple REST API to call the ScriptLibrary. But, not sure on retrieving records from SM Table.

Please advice, thanks

  • Hello again :)

    It's really simple to get records via the RESTful API.

    As example, I will use the extaccess record "Incident Management".

    extacces_im.PNG

    As you can see, the RESTful API is enabled for this.

    Now you have to call only: localhost:13080/.../incidents

    In my SOAP UI example, the result is the following:

    soapui.PNG

    To get the details from an incident, you have to call: localhost:13080/.../IM10001

    The result is something like that:

    soapui2.PNG

     

    Note: i used the "XML" Response in my examples. The JSON Response is the following (for the second screenshot)

    {
       "Incident":    {
          "Area": "failure",
          "Assignee": "Change.Analyst",
          "AssignmentGroup": "Application",
          "Category": "incident",
          "ClosedBy": "Incident.Analyst",
          "ClosedTime": "2014-08-14T22:08:17 00:00",
          "ClosureCode": "Diagnosed Successfully",
          "Company": "advantage",
          "Contact": "CAFFREY, AARON",
          "Description": ["Cannot add attachment to OneNote Shared directory."],
          "Impact": "3",
          "IncidentID": "IM10001",
          "JournalUpdates":       [
             "01/15/14 21:05:22 US/Mountain (Jennifer Falcon):",
             "Assign to Lopez"
          ],
          "OpenTime": "2013-12-29T20:02:55 00:00",
          "OpenedBy": "falcon",
          "Phase": "Closure",
          "Service": "CI1001030",
          "Solution": ["Cleanup the backups in document server, free spaces."],
          "Status": "Closed",
          "Subarea": "function or feature not working",
          "Title": "Cannot add attachment to OneNote Shared directory.",
          "UpdatedBy": "xuejun",
          "UpdatedTime": "2015-03-16T23:11:28 00:00",
          "Urgency": "3"
       },
       "Messages": [],
       "ReturnCode": 0
    }

     

     

     

    The documentation for this can be found here:

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

     

    Hope that helps :)

  • Hi Marcus, Thanks for the pointers above. We have used same settings as you mentioned as seen in the screenshot below, however, when accessing the SM/9/rest/incidents API endpoint, we get this error:

    A CxmlAPIException was raised in native code. error -1. Error in executing script RestfulMain.processResourceError in executing script: Type Error: log has no properties, ReturnCode -1

    Screenshot 2018-08-07 13.06.00.png

    Please advice. Appreciate your reply. Thanks!!

  • You started the post by saying you managed to call the ScriptLibrary via REST... What did you mean by that?  Did you by chance modify on OOB script?