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
------------------------------
Original Message:
Sent: Tue February 06, 2024 03:48 AM
From: LOIC POTIN
Subject: CA V12.0.1 - REST API Get Modules
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
------------------------------