Maximo

 View Only
  • 1.  How to import requests (http requests) module in automation script

    Posted 11 hours ago

    Hello,

    I want to perform HTTP Get using the APIKey to get the attached documents. For example: the following HTTP Get request renders the attached document from the browser:

    https://<host>/maximo/api/os/LBL_DS_EVCHARGE/<restid>/doclinks/<doclinkid>?lean=1&apikey=<apikey>

    I tried with the following:


        handler = HTTPHandler()
        map = HashMap()
        map.put("URL", <the above url>)
        map.put("HTTPMETHOD", "GET")
        responseBytes = handler.invoke(map,None)
        return responseBytes

    However it gives error: the connection to the HTTP handler for the endpoint failed. Review the error and server log files to determine the cause of the issue, for example, incorrect properties in the DefaultHTTPExit.java handler class.
        com.ibm.jsse2.util.j: PKIX path building failed: com.ibm.security.cert.IBMCertPathBuilderException: unable to find valid certification path to requested target

    I am not sure whether the above code can work using the APIKey or not or it is supposed to work with username/password.

    I therefore would like to use the python's native http "requests" library e.g. import requests. I tried import requests. However it gives error. 

    Any idea on how to use the "requests" module in the automation script?

    Pankaj Bhide



    ------------------------------
    Pankaj Bhide
    ------------------------------


  • 2.  RE: How to import requests (http requests) module in automation script

    Posted 9 hours ago

    Hi Pankaj,

    Maybe these two articles will help you to solve your requirement:



    ------------------------------
    Bartosz Marchewka
    IBM Maximo Consultant
    AFRY
    ------------------------------



  • 3.  RE: How to import requests (http requests) module in automation script

    Posted 8 hours ago

    Thanks Bartosz.  I already tried both and it did not work in our environment. It gave me error : psdi.util.MXSystemException: BMXAA1477E - The connection to the HTTP handler for the endpoint failed. Review the error and server log files to determine the cause of the issue, for example, incorrect properties in the DefaultHTTPExit.java handler class.
        com.ibm.jsse2.util.j: PKIX path building failed: com.ibm.security.cert.IBMCertPathBuilderException: unable to find valid certification path to requested target

    Not sure whether this error belongs to our environment or not. 

    Surprisingly if I copy/paste the same url in the browser, it shows me the contents of the file.



    ------------------------------
    Pankaj Bhide
    ------------------------------



  • 4.  RE: How to import requests (http requests) module in automation script

    Posted 7 hours ago

    Hi Pankaj,

    From the attached issue it looks like you have SSL handshake issue. In my opinion you need to import Trusted Certificate Authority (CA) the whole key chain to your environment. Please check this article: https://www.sharptree.io/blog/2023/2023-06-13-trust-ca



    ------------------------------
    Bartosz Marchewka
    IBM Maximo Consultant
    AFRY
    ------------------------------