Cognos Analytics

 View Only
  • 1.  REST API Pagination

    Posted Tue June 27, 2023 12:53 PM

    How do you paginate responses from the REST API? I am able to query a folder for the groups it contains, but the list is longer than 200 results.
    Any results past 200 are not returned in the response when performing a GET on api/v1/groups?parent_i=<PARENT_OBJECT_ID>.

    Is there a query param I should include to get the next page of results?

    #RESTAPI 



    ------------------------------
    STEVEN LINESES-140
    ------------------------------


  • 2.  RE: REST API Pagination

    Posted Wed June 28, 2023 10:05 AM

    I want to add I also have this issue

    The other issue I have is the REST API (the real REST API) doesn't return the IDs of the objects in the response, so if you want to traverse a folder tree, or get more info about a child object, it isn't possible. Unless there is a syntax I'm missing. This is a problem because the REST API uses the store IDs to access objects, NOT the CAM Search Path, which is what returns in the API responses.



    ------------------------------
    Charles Blake
    ------------------------------



  • 3.  RE: REST API Pagination

    IBM Champion
    Posted Thu June 29, 2023 03:43 AM
    Edited by Paul Mendelson Thu June 29, 2023 05:53 AM

    There are a few ways you can traverse the folder tree. Cognos supports WSIL and WSDL, so you could use those.

    https://<SERVER>/ibmcognos/bi/v1/disp/rds/wsil/path/Team%20Content/

    <!-- Licensed Materials - Property of IBM
    
    BI and PM: CCS
    
    (C) Copyright IBM Corp. 2005, 2009
    
    US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. -->
    <inspection xmlns="http://schemas.xmlsoap.org/ws/2001/10/inspection/" xmlns:wsilwsdl="http://schemas.xmlsoap.org/ws/2001/10/inspection/wsdl/">
      <link referencedNamespace="http://schemas.xmlsoap.org/ws/2001/10/inspection/" location="https://SERVER:80/ibmcognos/bi/v1/disp/rds/wsil/path/Team%20Content%2FAudit_Local">
        <abstract>Audit_Local</abstract>
      </link>
      <link referencedNamespace="http://schemas.xmlsoap.org/ws/2001/10/inspection/" location="https://SERVER:80/ibmcognos/bi/v1/disp/rds/wsil/path/Team%20Content%2FMotioCI">
        <abstract>MotioCI</abstract>
      </link>
      <link referencedNamespace="http://schemas.xmlsoap.org/ws/2001/10/inspection/" location="https://SERVER:80/ibmcognos/bi/v1/disp/rds/wsil/path/Team%20Content%2FMotioCI%20Reports">
        <abstract>MotioCI Reports</abstract>
      </link>
      <link referencedNamespace="http://schemas.xmlsoap.org/ws/2001/10/inspection/" location="https://SERVER:80/ibmcognos/bi/v1/disp/rds/wsil/path/Team%20Content%2FPACKAGES">
        <abstract>PACKAGES</abstract>
      </link>
      <link referencedNamespace="http://schemas.xmlsoap.org/ws/2001/10/inspection/" location="https://SERVER:80/ibmcognos/bi/v1/disp/rds/wsil/path/Team%20Content%2FTemplates">
        <abstract>Templates</abstract>
      </link>
      <link referencedNamespace="http://schemas.xmlsoap.org/ws/2001/10/inspection/" location="https://SERVER:80/ibmcognos/bi/v1/disp/rds/wsil/path/Team%20Content%2FZIPI">
        <abstract>ZIPI</abstract>
      </link>
    </inspection>

    You can also use WSDL to get a list of services:

    https://<SERVER>/ibmcognos/bi/v1/disp?wsdl 

    The full (for a given value of full) SOAP API can be found here: https://www.ibm.com/docs/en/cognos-analytics/11.2.0?topic=SSEP7J_11.2.0/com.ibm.swg.ba.cognos.ca_dg_sdk.doc/c_prm_reportnet_apis.htm

    On the flip side the REST API has a lot of features that are undocumented. I had to decompile (it's not hacking if it's your own server, right?) a few files to figure it out. Because they're not documented and I had to do a lot of digging I'm not sure if I should talk about them here. I proposed a session for TXC called "Unlocking Cognos: Using Secret APIs", in the very small chance it's approved I'll go into more details of my findings there.

    Hey, psst. Invisible text here! In the browser console try: await __glassAppController.glassContext.services.services.ajax.ajax({
              "type": "GET",
              "dataType":"json",
              "url": `${__glassAppController.glassContext.gateway}/v1/expressbus/content-manager?searchPath=/content/folder[@name='Templates']//*&properties=*`
          })


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