Hi Duncan,
Yes, assuming you don't have anonymous access enabled in your CA instance, you'll need to authenticate first to use CMS (aka RDS) REST calls to run/retrieve reports.
There are a few ways to do this, but CMS has its own logon authentication REST endpoints/methods ( e.g. the rds/auth/logon endpoint). This documentation describes how to use it and provides a sample: https://www.ibm.com/docs/en/cognos-analytics/12.0.0?topic=off-logging-using-mashup-service-authentication
After successfully authenticating with the rds/auth/login endpoint, your HTTP client will have the required cookies (e.g. the Cognos passport) set to proceed with further rds REST calls.
You can also see another approach to authentication, if you want to programmatically expose the CA login UI to your user, here: https://www.ibm.com/docs/en/cognos-analytics/12.0.0?topic=off-logging-using-standard-cognos-analytics-logon-page
A third option is to combine the authentication request and your rds/outputFormat request into a single request, using the /rds/auth/passthrough
endpoint. ( second option described here: https://www.ibm.com/support/pages/mashup-using-rest-url-logon-ibm-cognos-analytics-server)
(There are other methods for programmatically authenticating/obtaining the Cognos passport - like the new Cognos REST API - but since you are making CMS (rds) requests, it's probably easier to stick with its methods, and not have to duct tape things together using another approach.)
------------------------------
Jim Boland
LinkedIn:
https://www.linkedin.com/in/jimbolandWebsite:
https://coreinsightz.comEmail:
jimboland@coreinsightz.com------------------------------
Original Message:
Sent: Tue November 07, 2023 03:11 PM
From: Duncan Trowsdale
Subject: Download Cognos report
Do I need to collect a token first ?
------------------------------
Duncan Trowsdale
Original Message:
Sent: Tue November 07, 2023 06:51 AM
From: Duncan Trowsdale
Subject: Download Cognos report
Hi , i am trying to use postman to get a report content in JSON , using
/ibmcognos/bi/v1/disp/rds/outputFormat/report/i440BF50FF2C74F5496EE6A4492061474/JSON?async=off
i am getting 403 Forbidden
------------------------------
Duncan Trowsdale
Original Message:
Sent: Sun March 12, 2023 03:57 AM
From: Paul Mendelson
Subject: Download Cognos report
Try setting the async flag to off.
http://{GATEWAY}/v1/disp/rds/outputFormat/searchPath/content/folder[@name='Samples']/folder[@name='Models']/package[@name='GO Sales (query)']/folder[@name='Reporting Report Samples']/report[@name='Order Invoices - Donald Chow, Sales Person']/PDF?async=off
Details:
https://www.ibm.com/docs/en/cognos-analytics/11.2.0?topic=methods-running-asynchronous-versus-synchronous-requests
------------------------------
Paul Mendelson
Original Message:
Sent: Sat March 11, 2023 05:01 PM
From: Bek Ibragimov
Subject: Download Cognos report
Hi Paul, thank you for your reply. Can you give little more details how I can use it. I tried it via Postman and it is kinda working but when I get postman auto generated powershell script and run it in my machine I am getting below error. Any hints would be great, thank!
Invoke-RestMethod : 308 Permanent Redirect
nginx
At line:3 char:18
+ $loginresponse = Invoke-RestMethod 'http://mycognosserver/bi/v1/disp ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
Invoke-RestMethod : 308 Permanent Redirect
nginx
------------------------------
Bek Ibragimov
Original Message:
Sent: Sun March 05, 2023 10:08 AM
From: Paul Mendelson
Subject: Download Cognos report
You can do this with the Cognos Mashup Services API.
https://www.ibm.com/docs/en/cognos-analytics/11.2.0?topic=types-outputformat
http://{GATEWAY}/v1/disp/rds/outputFormat/searchPath/content/folder[@name='Samples']/folder[@name='Models']/package[@name='GO Sales (query)']/folder[@name='Reporting Report Samples']/report[@name='Order Invoices - Donald Chow, Sales Person']/PDF
You could also use the storeID
http://{GATEWAY}/v1/disp/rds/outputFormat/report/i0E130B9A0A21463582535CF2D47B45F8/spreadsheetML
------------------------------
Paul Mendelson
Original Message:
Sent: Fri March 03, 2023 02:36 PM
From: Bek Ibragimov
Subject: Download Cognos report
Hello Everyone,
I was wondering is there a way how to download cognos report in excel format with REST API. We are using Cognos Analytics 11.2.4.
Any hint would be appreciated.
Thank you
------------------------------
Bek Ibragimov
------------------------------