Cloverleaf API – SMATDB

Clovertech Forums Cloverleaf Cloverleaf API – SMATDB

  • Creator
    Topic
  • #118243
    Jonathan Souders
    Participant

      Anyone familiar with how this works? I’m trying to use the message search API call, but I have no idea what parameters I need to use for passing in the JSON – after I bit of finagling I was able to figure out the message API using the message ID, but this is not ideal for what I am tying to accomplish.

    Viewing 6 reply threads
    • Author
      Replies
      • #118244
        Rob Abbott
        Keymaster

          Hey Jonathan, great you are exploring the API!

          Have you checked out the swagger pages?  They might help point you in the right direction.

           

          From your browser:

          https://localhost:15037/clapi/swagger-ui.html

          https://localhost:15037/clapi/swagger-ui.html#/smat-db-controller

          https://localhost:15037/clapi/swagger-ui.html#!/smat-db-controller/searchMessagesUsingPOST_1

           

          (replace localhost with your server’s hostname if you’re not right on it, and port number will vary with version)

           

          Rob Abbott
          Cloverleaf Emeritus

          • #118247
            Jonathan Souders
            Participant

              Yes – but unfortunately I can’t decipher what parameters I need to supply to the following JSON object for the call to be successful, even from the Swagger UI.

              Any way you can clarify what the needed string values are for the criteria, encodes, Files, etc. keys?

              {
              “criteria”: [
              {
              “itemName”: “string”,
              “operator”: “string”,
              “required”: true,
              “val1”: “string”,
              “val2”: “string”
              }
              ],
              “encodes”: {},
              “filePasswordMap”: {},
              “files”: [
              “string”
              ],
              “msgNumPerPage”: 0,
              “pageNum”: 0,
              “sort”: {
              “ascending”: true,
              “metaName”: “string”
              },
              “visiableMetaNames”: [
              “string”
              ]
              }

            • #118248
              Jonathan Souders
              Participant

                Update:

                I figured out most of the keys and can get response data now… but I still don’t know what string values to pass to the Criteria object. Any assistance is appreciated.

              • #118263
                Jonathan Souders
                Participant

                  I opened a support ticket for this which has now been escalated to R&D as a defect. I’ll document the results here if/when I determine the solution.

                • #118268
                  Rob Abbott
                  Keymaster

                    Hi Jonathan sorry I didn’t follow up here.  You did the right thing reaching out to support – we’ll also improve our documentation with anything that comes out of this case.

                    Rob Abbott
                    Cloverleaf Emeritus

                  • #118275
                    Jonathan Souders
                    Participant

                      Thanks Rob. Posting the results in a separate comment.

                  • #118301
                    Jonathan Souders
                    Participant

                      Finally ended up getting this working with the below syntax (I asked Infor to update their documentation because part of this criteria I needed to use is not mentioned anywhere in Swagger or in the Java classes I decompiled while troubleshooting).

                       

                      For message search (content of message):

                      {
                      “files”:
                      [
                      “$HCIROOT/<site_name>/exec/processes/<process_name>/<file_name>”
                      ],
                      “criteria”:
                      [
                      {“type”:”plain”,”itemName”:”MESSAGECONTENT”,”operator”:”regular expression”,”val1″:<search_text_or_regex_query>}
                      ],
                      “sort”:{“ascending”:”true”},
                      “pageNum”:1,
                      “msgNumPerPage”:10
                      }

                      For message search (metadata example):

                      {
                      “files”:
                      [
                      “$HCIROOT/<site_name>/exec/processes/<process_name>/<file_name>”
                      ],
                      “criteria”:
                      [
                      {“type”:”plain”,”itemName”:”MID”,”operator”:”==”,”val1″:<cloverleaf_mid_value>}
                      ],
                      “sort”:{“ascending”:”true”},
                      “pageNum”:1,
                      “msgNumPerPage”:10
                      }

                       

                      For message resend (example of outbound thread message resend – most values can be pulled from the other CLAPI requests for SMAT):

                      {
                      “defaultEncoding”: “UTF-8”,
                      “encoding”: “UTF-8”,
                      “includeMeta”: “true”,
                      “messageType”: “DATA”,
                      “passwords”: {},
                      “priority”: 5120,
                      “resend_type”: “DATA”,
                      “criteria”: [
                      {
                      “type”: “plain”,
                      “itemName”: “MID”,
                      “operator”: “==”,
                      “val1”: <cloverleaf_mid_value>
                      }
                      ],
                      “srcThreadName”: “<thread_name>”,
                      “destThread”: “<thread_name>”,
                      “metatdataDestThreads”: “<thread_name>”,
                      “filename”: “<file_name>”,
                      “files”: [
                      “$HCIROOT/<site_name>/exec/processes/<process_name/<file_name>”
                      ],
                      “modifiedmessages”: [
                      {
                      “cloverMsgprofile”: {
                      “mid”: “0.0.10648074”,
                      “sendingTime”: 1608657356535,
                      “fileRelativePath”: “/exec/processes/<process_name/<file_name>”,
                      “marked”: false,
                      “indexRecordOffset”: 0,
                      “indexRecordLength”: 0,
                      “modified”: false,
                      “rowId”: “67”,
                      “smatInfoVersion”: 258,
                      “dispTimeFmtVersion”: 258,
                      “offsetMap”: {},
                      “filePath”: “$HCIROOT/<site_name>/exec/processes/<process_name/<thread_name>.smatdb”,
                      “fileName”: “<file_name>”
                      },
                      “metadata”: {
                      “TIMEXLT”: “1608657356534”,
                      “STATE”: “14”,
                      “PRIORITY”: “5120”,
                      “SKIPXLT”: “0”,
                      “TIMEIN”: “1608657356534”,
                      “USERECOVERDB”: “3”,
                      “SAVECONTEXT”: “outbound”,
                      “DATAFMT”: “{RESEND_DEST <thread_name>} {RESEND_DEST <thread_name>}”,
                      “SEPCHARS”: “”,
                      “FLAGS”: “33286”,
                      “TIMEQCUR”: “0”,
                      “TYPE”: “DATA”,
                      “SRCMID”: “<cloverleaf_mid_value>”,
                      “RETRIES”: “0”,
                      “DESTCONN”: “<thread_name>”,
                      “ORIGDESTCONN”: “<thread_name>”,
                      “GROUPID”: “0”,
                      “TIMESTOR”: “0”,
                      “XLTTHREAD”: “”,
                      “TIMEQTOT”: “0”,
                      “DBTABLE”: “”,
                      “SOURCECONN”: “<thread_name>”,
                      “ORIGSOURCECONN”: “<thread_name>”,
                      “TIMEREC”: “1608657356534”,
                      “TIMEOUT”: “1608657356534”,
                      “DRIVERCTL”: “{CONNID 0} {IPVERSION 4} {CLIENTIP <client_ip_address>} {CLIENTPORT 54568} {_TRXID_ ORM_O01}”,
                      “GROUPMID”: “”,
                      “USERDATA”: “”,
                      “TIMEARC”: “0”
                      },
                      “contentBase64String”: “<base64_message>”
                      }
                      ],
                      “processName”: “<process_name”,
                      “threadContext”: “ob_post_tps”
                      }

                    • #121233
                      Shivam Gohel
                      Participant

                        Hi @Jonathan,

                        Thank you for posting the dummy load. It’s impossible to figure this out from the documentation/SWAGGER UI. Though I was able to make the SMAT search work, I am still having a hard time figuring out the resend API.

                        I want to resend a single message through resend API. Would I be able to do that?

                        Here are the steps I am doing:
                        1. Getting list of messages (base64 encoded strings) from retrieve API.

                        2. Copying and pasting one of the messages metadata to resend.

                        Note that I don’t want to resend complete SMAT. I just want to send a single message which I am passing through base64 encoded string parameter.

                        Please help me with this.

                        • #121537
                          Jonathan Souders
                          Participant

                            Honestly I have not looked at this in quite some time and may not have the code anymore since moving on to different employers.

                            Are you still having this issue? If so, I can try to find my code or look at the API again but it might take me some time to get you an answer.

                        • #121520
                          Dirk Engels
                          Participant

                            Hi Jonathan,

                            with you post I was able to figure out how to do search. The documentation on this is still bad. Swagger doesn’t help much out.

                            But I still have a problem, because my smat databases are encrypted, so I have to provide a password. The only thing in swagger that fits this is:

                            “filePasswordMap”: {
                            “additionalProp1”: “string”,
                            “additionalProp2”: “string”,
                            “additionalProp3”: “string”
                            }

                            But how do I use it? Have you been able to figure this out?

                            Greetings from Germany,

                            Dirk

                            • #121538
                              Jonathan Souders
                              Participant

                                Hi Dirk:

                                I am not sure on this – since the databases I was working with were not using encryption, this was not something I explored.

                                If I can find my old code, I can try and work through this again to see what I can determine. I will get back to you some time next week once I look through my repository to see if I retained the code or not – if not, I will do my best to try and re-explore and see what I can figure out!

                                I agree with you about the Swagger documentation though, I had hoped that would have improved a bit by now.

                            • #121539
                              Dirk Engels
                              Participant

                                Hi Jonathan,

                                I have now tried the access without encrypted smat dbs, but I always get an error:

                                { “code”: “UnspecifiedError”, “message”: “java.lang.StringIndexOutOfBoundsException: String index out of range: -1”, “fieldErrors”: null }

                                Here is the body I post:

                                {
                                “files” :
                                [
                                “C:/HealthComm/cloverleaf/cis2022.09/integrator/hc_demosite/exec/processes/ADT/orbis_kus_adt_in.smatdb”
                                ],
                                “criteria”:
                                [{
                                “type”: “plain”,
                                “itemName”: “MESSAGECONTENT”,
                                “operator”: “regular expression”,
                                “val1”: “A01”
                                }],
                                “sort”:
                                {
                                “ascending”: “true”
                                },
                                “pageNum”: 1,
                                “msgNumPage”: 10
                                }

                              • #121550
                                James Cobane
                                Participant

                                  It would be great if Infor would produce/present a webinar series on how to interact with the Cloverleaf APIs.  We have many scripts that use the ncitlib functions that I would like to replicate with the CLAPI functionality.  Just my $.02

                                  Jim Cobane – Henry Ford Health

                                • #121551
                                  Jim Kosloskey
                                  Participant

                                    Good idea!

                                    email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

                                Viewing 6 reply threads
                                • You must be logged in to reply to this topic.