Maximo

 View Only
Expand all | Collapse all

CORS error in Mobile calling Maximo Automation script from Mobile through an Rest API call

  • 1.  CORS error in Mobile calling Maximo Automation script from Mobile through an Rest API call

    Posted Fri May 24, 2024 07:08 AM

    I am trying to call an API script in Maximo through making a Rest api call.
    The call with SoapUI is working. 

    However within Mobile I get the CORS error below:

    The url I use is:

    var baseLink = 'https://<MY SERVER>/maximo/api/script/DAMGETSPDOWNLOADLINK?apikey=<MY KEY>&lean=1';
    I tried to add some headers like:
    myHeaders.append('Access-Control-Allow-Origin', 'origin');
    myHeaders.append("Access-Control-Allow-Headers", "origin, X-Requested-With, Content-Type, Accept");
    Still getting the error.

    The interesting part is, is that the script is fired on the server. 
    I did put in some logging and it shows up in the SYSTEMOUT.LOG.
    However the response from the script is not picked up in Mobile.
    Can anyone help me with this issue?

    Regards,
    Vincent Wanders



    ------------------------------
    Vincent Wanders
    ------------------------------


  • 2.  RE: CORS error in Mobile calling Maximo Automation script from Mobile through an Rest API call

    Posted Tue May 28, 2024 03:31 AM

    It seems to be a Role Based issue. 

    Publishing the app and test my code works like a charm.

    Has anyone an idea why CORS is an issue on Role Based?



    ------------------------------
    Vincent Wanders
    ------------------------------



  • 3.  RE: CORS error in Mobile calling Maximo Automation script from Mobile through an Rest API call

    Posted Wed May 29, 2024 01:40 AM

    Further search narrows it down to Docker. It is not running locally.

    After some testing Publishing is the solution.

    It is only a problem when developing with a/on a non-local Docker environment it seems.



    ------------------------------
    Vincent Wanders
    ------------------------------