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.  Download Cognos report

    Posted 03/03/23 02:36 PM

    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
    ------------------------------


  • 2.  RE: Download Cognos report

    Posted 03/05/23 10:08 AM

    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
    ------------------------------



  • 3.  RE: Download Cognos report

    Posted 03/11/23 05:02 PM
    Edited by Bek Ibragimov 03/11/23 06:18 PM

    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
    ------------------------------



  • 4.  RE: Download Cognos report

    Posted 03/12/23 03:58 AM

    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
    ------------------------------



  • 5.  RE: Download Cognos report

    Posted 11/07/23 10:17 AM

    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

     <rds:message>RDS-ERR-1020 The currently provided credentials are invalid. Please provide the logon credentials.</rds:message>
    Do i need to share the report ? or set the security of a report so it can be accessed via postman 
    thanks


    ------------------------------
    Duncan Trowsdale
    ------------------------------



  • 6.  RE: Download Cognos report

    Posted 11/07/23 03:12 PM

    Do I need to collect a token first ?



    ------------------------------
    Duncan Trowsdale
    ------------------------------



  • 7.  RE: Download Cognos report

    Posted 11/08/23 05:30 AM

    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/jimboland
    Website: https://coreinsightz.com
    Email: jimboland@coreinsightz.com
    ------------------------------