Cognos Analytics

Cognos Analytics

Connect, learn, and share with thousands of IBM Cognos Analytics users! 


#Product
#Analytics
#CognosAnalytics
#Analyticstools
#TechXchange Partner
#TechXchange Session
#TechXchange Presenter
#AI
 View Only
  • 1.  CA V12.0.1 - REST API Get Modules

    Posted 01/18/24 08:50 AM
    Edited by LOIC POTIN 01/18/24 11:03 AM

    Hello all,

    I am testing REST API in Cognos Analytics V12.0.1 and i have seen a strange behaviour with the Get Modules API. This API should return all the data modules i have in my sandbox environment but it doesn't return the full list, only some of them.

    Are you aware of the problem with this API, have you noticed the same strange behaviour ?

    Is there a size limit for the Json file which contains the API return ? if yes how to update it ?

    In Cognos Analytics V11.1.7 the same API works fine.

    Any help would be appreciated.



    ------------------------------
    LOIC POTIN
    ------------------------------



  • 2.  RE: CA V12.0.1 - REST API Get Modules

    Posted 02/06/24 03:48 AM

    Hello All,

    Finally i have tested again the <sandbox_server_cognos>:9300/api/api-docs/#/modules/list_modules today and i was surprised to see that this time i got the full list of data modules in the system.

    It is probably related to a cache ...

    Best



    ------------------------------
    LOIC POTIN
    ------------------------------



  • 3.  RE: CA V12.0.1 - REST API Get Modules

    Posted 02/09/24 08:09 AM

    I prefer going through the gateway instead of contacting the server directly. Log into your Cognos instance and paste this into the console:

    const getCookie = function (name) {
              const value = `; ${document.cookie}`;
              const parts = value.split(`; ${name}=`);
              if (parts.length === 2) return parts.pop().split(';').shift();
            }
     
    let gateway = __glassAppController.glassContext.gateway
      , xsrfToken = getCookie('XSRF-TOKEN')
      , modules = await fetch(gateway+"/api/modules", {
      "headers": {
        "accept": "application/json, text/javascript, */*; q=0.01",
        "x-xsrf-token": xsrfToken
      },
      "method": "GET",
      "mode": "cors",
      "credentials": "include"
    }).then(x=>x.json());
     
    console.log(modules);


    ------------------------------
    Paul Mendelson
    ------------------------------



  • 4.  RE: CA V12.0.1 - REST API Get Modules

    Posted 02/13/24 03:14 AM

    Hello Paul,

    Thanks for your suggestion I will try it !

    Best.



    ------------------------------
    LOIC POTIN
    ------------------------------